> For the complete documentation index, see [llms.txt](https://academy.pentaho.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://academy.pentaho.com/pentaho-ctools/c-tools/community-data-access/creating-a-cda/cda-api.md).

# CDA API

{% hint style="info" %}
Understanding the API allows you to leverage CDA (Community Data Access) to integrate data with external applications. This capability is particularly valuable when you're not using CDE (Community Dashboard Editor) or CDF (Community Dashboard Framework) for dashboard development.

The API integration with CTools provides enhanced functionality through CDA's Web API interface. To make requests, use this base URL structure:
{% endhint %}

```
$BASE_URL/$WEBAPP/plugin/cda/api/
```

{% hint style="info" %}
Where:

&#x20; • `$BASE_URL` represents the protocol, hostname, and port

&#x20; • `$WEBAPP` is the Apache Tomcat web application name (default is 'pentaho')
{% endhint %}

{% hint style="info" %}
Here's a sample URL demonstrating a query to the pentaho webapp:
{% endhint %}

{% embed url="<http://localhost:8080/pentaho/plugin/cda/api/doQuery?dataAccessId=top50Customers&path=/public/CTools-Dashboard/CDA/sampledata-queries.cda>" %}

***

#### APIs

{% tabs %}
{% tab title="getCdaList" %}
{% hint style="info" %}
The getCdaList endpoint will get a list of all the CDA files available inside the repository. There is no need to specify the parameters for this endpoint.
{% endhint %}

{% embed url="<http://localhost:8080/pentaho/plugin/cda/api/getCdaList>" %}
{% endtab %}

{% tab title="listQueries" %}
{% hint style="info" %}
To retrieve all available queries from a CDA file, use the listQueries endpoint.

Parameters:

`path` (required): Specifies the location of the CDA file to analyze

`outputType` (optional): Sets the response format

&#x20; • Default: `json`

&#x20; • Alternative: `xml`
{% endhint %}

```
http:/localhost:8080/pentaho/plugin/cda/
api/listQueries?path=/public/CTools-Dashboard/CDA/sampledata-queries.cda
```

{% endtab %}

{% tab title="listParameters" %}
{% hint style="info" %}
This endpoint retrieves all parameters defined within a specified query.

Required Parameters:

`path`: The location of the CDA file containing the query definitions

`dataAccessId`: The identifier of the specific query to examine

Optional Parameters:

`outputType`: The desired format for the response

&#x20; • Default: `json`

&#x20; • Alternative: `xml`
{% endhint %}

{% embed url="<http://localhost:8080/pentaho/plugin/cda/api/listParameters?dataAccessId=top50Customers&path=/public/CTools-Dashboard/CDA/sampledata-queries.cda>" %}
{% endtab %}

{% tab title="doQuery" %}
{% hint style="info" %}
The method executes a query and returns its results. It requires two mandatory parameters:

`path`: Specifies which file contains both:

&#x20; • The connection settings

&#x20; • The query to be executed

`dataAccessId`: Identifies which data access definition from the CDA file should be used. This definition links to a connection that was previously configured (as covered in the previous chapter).

When using parameters in your query, include them in the URL as `paramParameter`, where "Parameter" is replaced with the actual parameter name.

Optional Parameters:

`outputType`: Controls the format of the returned results

&#x20; • Default: `json`

&#x20; • Other formats: `xml`, `csv`, `xls`, `html`

#### Query Pagination and Parameters in CDA

#### Basic Pagination

To implement pagination in your queries, use these parameters:

`paginateQuery` (Boolean): Enable/disable pagination

`pageStart`: Starting row number

`pageSize`: Number of rows per page

#### Additional Query Parameters

`bypassCache` (Boolean): When set to true, forces a fresh database request instead of using cached data

`sortBy`: Specify column(s) for sorting results
{% endhint %}
{% endtab %}

{% tab title="previewQuery" %}
{% hint style="info" %}
This method will open the CDA previewer.
{% endhint %}

{% embed url="<http://localhost:8080/pentaho/plugin/cda/api/previewQuery?dataAccessId=top50Customers&path=/public/CTools-Dashboard/CDA/sampledata-queries.cda>" %}
{% endtab %}

{% tab title="editFile" %}
{% hint style="info" %}
This method will open the CDA editor for a particular query. We should define a parameter with the path to the CDA file. The parameter is path.&#x20;
{% endhint %}

{% embed url="<http://localhost:8080/pentaho/plugin/cda/api/editFile?path=/public/CTools-Dashboard/CDA/sampledata-queries.cda>" %}

<figure><img src="/files/tKt2tNzdOlnBmEqtgwlf" alt=""><figcaption><p>Edit CDA</p></figcaption></figure>
{% endtab %}
{% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://academy.pentaho.com/pentaho-ctools/c-tools/community-data-access/creating-a-cda/cda-api.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
