Our query API follows the MongoDB standard, with some small variations.

Dates and date-times need to be escaped using # symbols. #YYYY-MM-DD# and #YYYY-MM-DD HH:mm:ss# are valid formats, and date-times are in local time.

ALMOST all of the aggregation pipeline operators are available. Things like $lookup are blocked.

Your API token is:

<your token>

Avaliable tables are:

Get all of the data as a .csv: Since we don't need a filter, we can use a GET request.

GETS are the simplest way to request data, and if you don't need anything else, just use it.

curl -H "Authorization: Bearer <your token>"  > my.csv
              
Filter using matches: To get all the rows , POST the query shown in green.

Queries are written using the mongoDB query language. Match statements are structured as JSON objects, e.g. {"field_name":value_to_match}.

MongoDB tutoral: https://docs.mongodb.com/manual/tutorial/query-documents/

Query operators you can use: https://docs.mongodb.com/manual/reference/operator/query/

curl -X POST  -H "Content-Type: application/json" -H "Authorization: Bearer <your token>" -d ''  > my.csv
              
Use an aggregation: Get the total number of rows.

If you want to have more control or do aggregations then you may use the mongoDB query pipeline: https://docs.mongodb.com/manual/core/aggregation-pipeline/

ALMOST all of the aggregation pipeline operators are available. Things like $lookup are blocked.

Any time you hand over a JSON array as your query, it will hand the query to the aggregation pipeline.

curl -X POST  -H "Content-Type: application/json" -H "Authorization: Bearer <your token>" -d '[{"$count":"row_count"}]' 
              
Use an aggregation: Get the total number of rows there are .

A two stage pipeline in which we filter rows, and then count the result. Note how the two stages are each objects in an array.

curl -X POST  -H "Content-Type: application/json" -H "Authorization: Bearer <your token>" -d '[{"$match":},{"$count":"row_count"}]' 
              
Use an aggregation: Find how many rows there are in 2020.

Dates and date-times need to be escaped using # symbols.

#YYYY-MM-DD# and #YYYY-MM-DD HH:mm:ss# are valid formats.

Dates and times are in local time.

curl -X POST  -H "Content-Type: application/json" -H "Authorization: Bearer <your token>" -d '[{"$match":{","SETTLEMENT_DATE":{"$gte":"#2020-01-01#", "$lt":"#2021-01-01#"}}},{"$count":"row_count"}]'