The Enable API contains a number of asynchronous endpoints. The data returned from these endpoints has to be compiled from a number of different sources and therefore can take a little longer to process. This article will detail how to use these endpoints to receive data asynchronously as well as how the reporting endpoints work.
As always the basic overview of these endpoints are described within the API reference section.
When requesting data from a reporting endpoint, instead of the requested data immediately being returned, you will receive a payload including a queue-job id.
Here is an example payload.
This will tell you that the request is being process and provides a "self" link which you can poll until your data is available. When the queue job has completed a request to this link will automatically redirect you to your data.
The deal earnings report provides a breakdown of your deal's earnings by it's included dimension items. It is asynchronous and due to its nature behaves slightly differently to other endpoints.
A request with no parameters will simply return your deal's earnings.
However you can provide view by parameters using the query string syntax shown below.
Doing so will break down your results by the provided dimensions. Each result will have related items which correspond to the dimensions provided.
Let's run through an example. Let's say your Enable instance has two dimensions configured, Products and Branches with id's (accessible from the Dimensions endpoint) of 'prod' and 'bran' respectively. You also have a deal configured with id 'abc1'. Let's also include the items relationship in our response.
The response would then return the breakdown of the deal's earnings for each Product in each Branch.
Here we can see that the shown deal-earning item are the earnings for the product and branch with ids Qjy7 and N3Mb. The included section will also have more details on the items themselves, or you can access the items endpoint via the self link.
It is possible to filter all of the attributes for this report as well as a number of the related item attributes: id, name, startDate and endDate. This can be achieved through the following query syntax ?filter[items.id]=in:abc1,abc2.
Note that because this is a relationship, only the IN operator is supported. Each deal-earning item in the result set must be related to at least one item which matches the the filter condition.
It is possible to filter all of the attributes for this report. However it is not possible to sort by related attributes. This is achieved through our usual sorting syntax sort=actualEarnings.