Instead of fetching the report data instantly, you can retrieve it in an asynchronous way. It means that you don’t get the requested data immediately when you send the POST request. Instead, the API returns a 303 response, which includes the Location header. The header contains a URL that you can use to get the data.

Follow the workflow below to enable the asynchronous mode, get the data, and navigate between pages.

Enable asynchronous mode

  1. Set the async flag to true as a query parameter in your POST request. Example:

    /reporting-api/v2/reports/{productFamily}/{reportingArea}/{report}/data?async=true
    
  2. To enable pagination, specify a pageSize value as a query parameter in your POST request. For example, pageSize=5 means that a page will contain 5 data rows.

    /reporting-api/v2/reports/{productFamily}/{reportingArea}/{report}/data?async=true&pageSize=5
    
  3. Send the POST request.

You get a 303 response with the Location header, which you can use to fetch the data. Note it may take some time before the data is ready to fetch.

Get the data

Send the Get asynchronous report results request to retrieve the report data.

In your request, include a URL returned in the Location header from the POST operation you sent before. The URL contains a query_id, which is a unique identifier of that POST request.

GET /reporting-api/v2/reports/{productFamily}/{reportingArea}/{report}/queries/query_id

Example:

GET /reporting-api/v2/reports/{productFamily}/{reportingArea}/{report}/queries/.kRGhlJDv5gD34L8Ht...uSgJz8KpOZFBAl+2RIs=

If your POST request is still being processed, but you send a GET request with the provided link, the API returns a 303 response with the Location header again. It contains the same link sent by the API previously. The situation repeats until the report's data is ready.

Navigate between pages

With enabled pagination, you can navigate between pages through links available in the metadata section of a GET response, when the data is ready. Each page has a separate link in the href field.

Example:

 "links": [
     {
       "rel": "first",
       "href": "/reporting-api/v2/reports/{productFamily}/{reportingArea}/{report}/queries/.kRGhlJDQv5gD34LH...grutt1fThvl+2RIs=",
        "allow": [
          "GET"
        ]
     }

Use the link in the Get asynchronous report results operation to retrieve the data from that page.