Reports
Setup a report
Learn how to create a report via the dashboard.
There are two ways to setup a report, either via the dashboard or via the API.
Using Dashboard
- Go to Reports in the top bar
- Choose the type of report you want to generate
- Follow the creation steps
- Check the report’s executions in “Generated” tab
- Download report
Using API
1. Create a report
Request: POST {url}/reports/
{
"name": "Successful captures",
"spec": {
"params": {
"fields": ["id", "captured_at", "amount"],
"sort": [
{
"field": "created_at",
"order": "asc"
}
],
"filters": {
"status": ["capture_succeeded"]
}
}
}
}
Response:
{
"type": "report",
"id": "71aa8d49-5ec7-43aa-b13c-9b16fdae0f9b",
"name": "Successful captures",
"created_at": "2022-10-28T10:15:36.547789+00:00",
"updated_at": "2022-10-28T10:15:36.547789+00:00",
"next_execution_at": null,
"description": null,
"schedule": "once",
"schedule_enabled": false,
"schedule_timezone": "Etc/UTC",
"spec": {
"model": "transactions",
"params": {
"sort": [
{
"field": "created_at",
"order": "asc"
}
],
"fields": ["id", "captured_at", "amount"],
"filters": {
"method": null,
"scheme": null,
"status": ["capture_succeeded"],
"currency": null,
"metadata": null,
"voided_at": null,
"created_at": null,
"captured_at": null,
"authorized_at": null
}
}
},
"latest_execution": {
"type": "report-execution",
"id": "0848ef01-f44a-4564-abdb-52a1344bac63",
"created_at": "2022-10-28T10:15:36.571232+00:00",
"updated_at": "2022-10-28T10:15:36.611495+00:00",
"status": "dispatched",
"context": {
"reference_timestamp": "2022-10-28T10:15:36.571232+00:00",
"reference_timezone": "Etc/UTC"
}
}
}
2. Check report’s executions (optional)
Request: GET {url}/reports/71aa8d49-5ec7-43aa-b13c-9b16fdae0f9b/executions
Response:
{
"items": [
{
"type": "report-execution",
"id": "0848ef01-f44a-4564-abdb-52a1344bac63",
"created_at": "2022-10-28T10:15:36.571232+00:00",
"updated_at": "2022-10-28T10:15:36.611495+00:00",
"status": "dispatched",
"context": {
"reference_timestamp": "2022-10-28T10:15:36.571232+00:00",
"reference_timezone": "Etc/UTC"
},
"report": {
"type": "report",
"id": "71aa8d49-5ec7-43aa-b13c-9b16fdae0f9b",
"name": "Successful captures"
}
}
],
"limit": 20,
"next_cursor": null,
"previous_cursor": null
}
3. Generate report’s execution URL
3.1. Check that the report’s execution has been processed (optional)
Request: GET {url}/report-executions/0848ef01-f44a-4564-abdb-52a1344bac63
Response:
{
"type": "report-execution",
"id": "0848ef01-f44a-4564-abdb-52a1344bac63",
"created_at": "2022-10-28T10:15:36.571232+00:00",
"updated_at": "2022-10-28T10:15:46.162249+00:00",
"status": "succeeded",
"context": {
"reference_timestamp": "2022-10-28T10:15:36.571232+00:00",
"reference_timezone": "Etc/UTC"
},
"report": {
"type": "report",
"id": "71aa8d49-5ec7-43aa-b13c-9b16fdae0f9b",
"name": "Successful captures"
}
}
Status
succeeded
status means that the report has been generated.
3.2. Generate execution’s URL
Request: POST {url}/reports/71aa8d49-5ec7-43aa-b13c-9b16fdae0f9b/executions/0848ef01-f44a-4564-abdb-52a1344bac63/url
Response:
{
"url": "https://url/to/report/file",
"expires_at": "2022-10-28T10:21:33.345947+00:00"
}
Finally, download the report using URL from response.
Was this page helpful?