Skip to main content
The Easol reporting API works in an asynchronous way where you first make a POST to create a ReportRun, in this post you can specify any filtering you want to apply to the output. You then can fetch the result of this run in a separate request as a CSV.

Creating a report run

The first step in creating a ReportRun is finding the id of the Easol report you want to fetch the data for. You can do this by using the /reports endpoint
cURL
curl --request GET \
  --url https://api.myeasol.com/reports \
  --header 'Authorization: Bearer <token>'
This will respond with a list of all the reports available to you
{
  "data": [
    {
      "id": "f2316447-244f-4340-b1b7-65479c3b0aa0",
      "name": "Sales",
      "columns": [
        {
          "id": "ed73474f-f294-402a-9bc5-8c1ea23b7a84",
          "name": "ID",
          "type": "id"
        },
        {
          "id": "4ae0b552-0ac2-4cb8-9c71-783f0820ed6d",
          "name": "Booking reference",
          "type": "string"
        },
        {
          "id": "34d09a2d-9113-4e6d-aeda-35a136643488",
          "name": "Booking date",
          "type": "datetime"
        },
		...
      ]
    },
    ...
  ]
}
In this output you can see the id for any corresponding report, these will match the reports you can see in the Easol backend. Once you have the report id you’re ready to create a report run. To do this you can use the /reports/{report_id}/runs endpoint. There’s a number of parameters you can send to this endpoint for filtering your data
interval_start
string
If you only want to fetch data since a certain time you can use interval_start, this expects an ISO 8601 timestamp.
interval_end
string
If you only want to fetch data up until a certain time you can use interval_end, this expects an ISO 8601 timestamp.
search_query
string
You can use the search_query param to perform a plain text search across the data in your report.
last_updated_since
string
If you’re maintaining the data from your reports elsewhere you might only want to fetch data which has changed since the last type you fetched, you can use last_updated_since for that, this expects an ISO 8601 timestamp.
For example, if we wanted to fetch sales data since 2024-08-06 that matches the term “Joe” we might make a request like:
cURL
curl --request POST \
  --url https://api.myeasol.com/reports/f2316447-244f-4340-b1b7-65479c3b0aa0/runs \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "search_query": "Joe",
  "interval_start": "2024-08-06 13:00"
}'
This will respond with a ReportRun object like:
{
  "data": {
    "id": "8fad0f89-f3d7-4110-b4dc-b2c07f0ba1d7",
    "column_ids": [],
    "interval_end": null,
    "interval_start": "2024-08-06 13:00",
    "last_updated_since": null,
    "report_id": "f2316447-244f-4340-b1b7-65479c3b0aa0",
    "search_query": "Joe",
    "state": "pending"
  }
}
Now we have this we can move onto fetching the result of that run.

Fetching the result of a report run

Now that we have a report run created we can use its id to check on the state of the report run and then fetch its data. Using the /reports/runs/{id} endpoint we can check on the state of a report. This state can be one of ["pending", "succeeded", "failed"], once a run is in the succeeded state you can keep checking by polling this request. If a run is succeeded then there’ll be a new result property available on the ReportRun
{
  "data": {
    "id": "a49c7a48-3811-4237-bac6-da0e1d963be9",
    "column_ids": [],
    "interval_end": null,
    "interval_start": "2024-08-06 13:00",
    "last_updated_since": null,
    "report_id": "f2316447-244f-4340-b1b7-65479c3b0aa0",
    "result": "https://api.myeasol.com/reports/files/a49c7a48-3811-4237-bac6-da0e1d963be9",
    "search_query": "Joe",
    "state": "succeeded"
  }
}
That resultproperty reference a /reports/files/{id} endpoint which we can now use to fetch the results of our report.
cURL
curl --request GET \
  --url https://api.myeasol.com/reports/files/a49c7a48-3811-4237-bac6-da0e1d963be9 \
  --header 'Authorization: Bearer <token>'
This will return with a text/csv response which contains the CSV data for the report you requested.