Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

If your initial request return the above mentioned header not all the matching reports were included in the provided response and you will need request the rest of the reports by including the cursor to the next request. When you send your initial Report Export request the first page of data will be provided as the response and further data is fetched using cursor.

In the below example request "size" parameter is set to 1 so executing this request returns a single report and the rest of the matching reports need to be requested using cursors.

Code Block
titleExample report export request
curl --request POST \
  --url https://api.eu-west-1.blancco.cloud/v1/report/export \
  --header 'Content-Type: application/json' \
  --header 'X-BLANCCO-API-KEY: {API_KEY}' \
  --data '{
  "filter": {
    "date": {
      "gte": "2020-07-01T00:00:00Z"
    }
  },
  "format": "XML",
  "container": "NONE",
  "size": 1
}'

The response headers will be similar to below, including the X-BLANCCO-CURSOR header which is going to be used to fetch the next report.

Code Block
titleExample request response headers
date: Thu, 20 Jul 2023 12:52:17 GMT
content-type: application/xml;charset=UTF-8
content-length: 4994
apigw-requestid: ABCd1e-2fgHIJk=
vary: Origin
vary: Access-Control-Request-Method
vary: Access-Control-Request-Headers
x-blancco-cursor: 1234567890123,1234a12b-cd1e-1234-a123-1a2345b6789c
content-disposition: attachment; filename=reports.xml
x-content-type-options: nosniff
x-xss-protection: 1; mode=block
cache-control: no-cache, no-store, max-age=0, must-revalidate
pragma: no-cache
expires: 0
x-frame-options: SAMEORIGIN

To get the next page of data (in this case the next individual report) the value of the X-BLANCCO-CURSOR header needs to be included in the next request. There are two possibilities to include the value depending on API endpoint being used:

  1. Include the value as the URL parameter (in the endpoint URL)
  2. Include the value as part of the JSON payload

Some endpoints allow using both options, if both are defined at the same time the URL parameter value will be used.

Including the value as the URL parameter

In order to include the cursor as a URL parameter you need to edit the url you are sending the request to and include "?cursor={CURSOR_VALUE}" to the end of the URL (without the quotes).

Below example shows the updated URL and executing this request exports the next matching report.

Code Block
titleExample report export request including cursor
curl --request POST \
  --url  https://api.eu-west-1.blancco.cloud/v1/report/export?cursor=1689755023000%2C6020d30b-ea6d-4478-a180-7a2550e9962b \
  --header 'Content-Type: application/json' \
  --header 'X-BLANCCO-API-KEY: {API_KEY}' \
  --data '{
  "filter": {
    "date": {
      "gte": "2020-07-01T00:00:00Z"
    }
  },
  "format": "XML",
  "container": "NONE",
  "size": 1
}'

Including the value in the JSON payload

To include the cursor value in the JSON payload it simply needs to be defined as the value for key named "cursor".

Below example show the updated JSON payload with the cursor key-value pair being included. Executing this request exports the next matching report.

Code Block
titleExample report export request including cursor
curl --request POST \
  --url  https://api.eu-west-1.blancco.cloud/v1/report/export \
  --header 'Content-Type: application/json' \
  --header 'X-BLANCCO-API-KEY: {API_KEY}' \
  --data '{
  "filter": {
    "date": {
      "gte": "2020-07-01T00:00:00Z"
    }
  },
  "format": "XML",
  "container": "NONE",
  "size": 1,
  "cursor": "1234567890123,1234a12b-cd1e-1234-a123-1a2345b6789c"
}'