Developers Query Language(DQL)
The Developers Query Language (DQL) is an API feature that lets you use query clauses in the query parameters of a listing request, offering extended functionality compared to standard filters.
To find out whether an API has DQL implemented, visit its endpoint in the API reference and check whether it has the following type of notice:
📘 Developers Query Language (DQL)
This endpoint supports requests using the Developers Query Language (DQL).
Fields Operators accountId indate lt,gt
Query clauses
A query clause is the name given to the smallest unit used by DQL to perform a query on an API that supports it.
A query clause can be divided into 3 parts:
- Field
- Operator
- Value
Field
The field is the property to which the operation described in the Operator will be applied.
Operator
The operator is the logical unit of the clause, indicating which operation should be performed using the Value on the Field.
| Operator | Description |
|---|---|
gt | Greater than - This operator queries only values greater than the one provided |
lt | Less than - This operator queries only values less than the one provided |
in | In - This operator queries only values provided in, or contained in, the list |
Value
The value is the part of the clause that specifies a value or a list of values separated by commas to be used when applying the Operator on the specified Field.
Clause format
A query clause takes the form Field:Operator=Value and is always used as a query parameter.
For example:
curl --request GET \
--url 'https://api.uat.empresas.btgpactual.com/37297902000141/banking/accounts/statements?date%3Alt=2024-07-16&date%3Agt=2024-06-09&accountId%3Ain=37297902000141-208-50-009999990' \
...
In this request, we can see three clauses in use, each using a different operator:
date:lt=2024-07-16date:gt=2024-06-09accountId:in=37297902000141-208-50-009999990
Where:
| Unit | Value |
|---|---|
| Clause | date:lt=2024-07-16 |
| Field | date |
| Operator | lt |
| Value | 2024-07-16 |
| Result | Filters the request for results with a date earlier than 2024-07-16 |
| Unit | Value |
|---|---|
| Clause | date:gt=2024-06-09 |
| Field | date |
| Operator | gt |
| Value | 2024-07-16 |
| Result | Filters the request for results with a date later than 2024-06-09 |
| Unit | Value |
|---|---|
| Clause | accountId:in=37297902000141-208-50-009999990 |
| Field | accountId |
| Operator | in |
| Value | 37297902000141-208-50-009999990 |
| Result | Filters the request for results with accountId equal to 37297902000141-208-50-009999990 |