Related articles

DevelopersAPI guides

Asynchronous and reporting endpoints

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.

Queue jobs

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.

{ "data": { "type": "queue-jobs", "id": "8gVX", "attributes": { "status": "Pending" } }, "links": { "self": "/v1/reports/deal-earnings/queue-jobs/8gVX" } }

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.

Deal earnings

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.

viewBy[dimension]={dimensionId},...

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.

curl --request GET "https://api.deal-track.com/v1/reports/deal-earnings/abc1?viewBy[dimensions]=prod,bran&include=items" --header "Authorization: Bearer eyJh...."

The response would then return the breakdown of the deal's earnings for each Product in each Branch.

{ "data": [ { "id": "abc1", "type": "deal-earnings", "attributes": { "actualEarnings": 5510.5149, "forecastEarnings": 5510.5149, "accrualEarnings": 5510.5149, "actualForecastEarnings": 5510.5149 }, "relationships": { "deal": { "links": { "self": "v1/deals/abc1" } }, "items": { "links": { "self": "/v1/items?filter[id]=in:Qjy7,N3Mb" }, }, } ... ], "included": [ ... ] }

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.

Filtering

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.

Sorting

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.

Not useful
1
2
3
4
5
Very useful
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.

Still have questions?
Raise a ticket or contact our support team.