ACME's Reporting API endpoints can be leveraged to execute reports without having to login to ACME Backoffice to run individual report instances. Using the API you can automate your reporting and retrieve data at any time to meet your reporting needs. This guide intends to explain the steps to implement this feature.
TABLE OF CONTENTS |
Prerequisites
To utilize the ACME API, you will need the following:
- ACME API Key to your ACME tenant database. See Requesting an API Key for instructions.
- An API platform for using ACME APIs with active access.
- Pre-configured report definitions in ACME for the reports you would like to execute.
Process
Prerequisite: Configure Report Definition
If not already present, configure your desired report in ACME Backoffice. Set the top level parameters and filters, and the fields to include in your output. Take note of the Report Definition ID that is in the URL of the report.
Note: Output fields are defined by the Group By/Summarize By fields OR the selected fields in Edit Columns if no grouping is applied.
Step 1: Get Report Definition
You will need to obtain the query expression from the report you will be executing. Use the report definition ID from the report URL as the {id}.
Method | Endpoint | Payload | Response |
GET | /v2/b2b/analytics/report/definitions/{id} | None | Report Definition |
Note the queryExpression that is in the response. You will need this in Step 2.
Step 2: Execute Report
In your request, insert the queryExpression obtained from Step 1 in your payload to execute the report.
Method | Endpoint | Payload | Response |
POST | /v2/b2b/async/report | Async Report Object | Async Report Object |
Note the report instance ID, which will be used to confirm status in Step 3.
Step 3: Confirm Report Status
Use the report instance ID obtained in Step 2 to confirm the report status. Some reports may take time to execute. Make sure the report status is Complete before you retrieve the results.
Method | Endpoint | Payload | Response |
GET | /v2/b2b/async/report/{id} | None | Async Report Object |
Step 4: Retrieve Report Results
Once the report’s status is “complete", obtain the report output via JSON or CSV format using the report instance ID obtained in Step 2.
Method | Endpoint | Payload | Response |
GET | /v2/b2b/async/report/json/{id} | None | JSON-formatted report results |
GET | /v2/b2b/async/report/csv/{id} | None | CSV-formatted report results |