Skip to the content

User guide > Data Browser > Data access via API > API - Detailed guidelines > Asynchronous API

Purpose of ASYNC API

The ASYNC API is a programmatic access for asynchronous responses to large data requests.

For the SDMX APIs, data can be returned either synchronously or asynchronously:

  • Synchronously: the data is returned directly in the response to the request. This is the default operation
  • Asynchronously: the data is not returned directly in the response. Instead a key is returned in the response which allows to access the data through the async API to check for its availability and eventually retrieve it once available.

The decision whether to deliver the data synchronously or asynchronously is related to factors such as the complexity of the query and the volume of the data (number of rows) to be returned and the fair use of the service (see details in the section below).

In case the requested filtered data would be to important to be prepared, a client error code 413 is returned with a suggestion to apply more filtering to the request.

<S:Fault xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
    <faultcode>413</faultcode>
    <faultstring>EXTRACTION_TOO_BIG: The requested extraction is too big, estimated 420709314 rows, max authorised is 5000000, please change your filters to reduce the extraction size</faultstring>
</S:Fault>

User guide > Data Browser > Data access via API > API - Detailed guidelines > Asynchronous API

User guide > Data Browser > Data access via API > API - Detailed guidelines > Asynchronous API 2

Fair use of the service

A request for data extraction will be forced to be processed asynchronously based on the evaluation of 3 main criteria:

  • the number of concurrent data extraction requests
  • the number of requests performed during a period
    • per day
    • during the last 7 days
    • during the last 30 days
  • the cumulative "extraction cost" generated during a period
    • per day
    • during the last 7 days
    • during the last 30 days

If one of the above criteria exceeds some thresholds, further data extraction requests will be forced to be processed asynchronously and this as long as the rule is violated.

In order to avoid this, we recommend to:

  • trigger 1 extraction request at a time
  • in case of use of scripts, don't use parallelisation
  • if applicable, get data from the bulk download

How to implement asynchronous requests?

The asynchronous delivery process can be summarized as follows:

  1. Step 1 A client issues a request to one of the SDMX data API. The API returns a response indicating asynchronous delivery pattern, with a unique key
  2. Step 2 The client issues to the asynchronous endpoint at regular interval a request with the unique key, to enquire about the readiness of the requested data
  3. Step 3 Once the data is available, the client can request the data for the provided unique key and receive it

Example

Step 1: Initial request

For an initial data request for which asynchronous delivery pattern must be used, the response is similar to following XML:

<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
    <env:Header />
    <env:Body>
        <ns0:syncResponse xmlns:ns0="http://estat.ec.europa.eu/disschain/soap/extraction">
            <processingTime>412</processingTime>
            <queued>
                <id>98de05ea-540a-43d3-903b-7c9e14faf808</id>
                <status>SUBMITTED</status>
            </queued>
        </ns0:syncResponse>
    </env:Body>
</env:Envelope>
The <id> value, 98de05ea-540a-43d3-903b-7c9e14faf808 in this example is the key to use for checking data availability against the asynchronous API.

User guide > Data Browser > Data access via API > API - Detailed guidelines > Asynchronous API 3

Step 2: Get the current status of the request

The status of a request that is processed asynchronously can be one of the following values:

Value Meaning
SUBMITTED The request is submitted for processing
PROCESSING The request is currently being processed
AVAILABLE The data is available for download
EXPIRED The data is no longer available. This occurs after a few days or when corresponding dataset content was updated. Please restart from Step 1.
UNKNOWN_REQUEST In case the key provided cannot be matched to a request
ERROR

The request was processed but an unexpected error occurred.

Please retry or contact support with id of your request

The current status of a given request can be obtained via a REST request:

This request may provide different results, depending on the current status of the request:

  • PROCESSING: As long as the request is not processed/finished, the following result will be returned:
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
    <env:Header />
    <env:Body>
        <ns0:asyncResponse xmlns:ns0="http://estat.ec.europa.eu/disschain/soap/asynchronous"
            xmlns:ns1="http://estat.ec.europa.eu/disschain/asynchronous">
            <ns1:status>
                <ns1:key>98de05ea-540a-43d3-903b-7c9e14faf808</ns1:key>
                <ns1:status>PROCESSING</ns1:status>
            </ns1:status>
        </ns0:asyncResponse>
    </env:Body>
</env:Envelope>

User guide > Data Browser > Data access via API > API - Detailed guidelines > Asynchronous API 4

  • AVAILABLE: The request is processed/finished. When the query is fully executed, the returned status will be AVAILABLE and the following result will be returned:
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
    <env:Header />
    <env:Body>
        <ns0:asyncResponse xmlns:ns0="http://estat.ec.europa.eu/disschain/soap/asynchronous"
            xmlns:ns1="http://estat.ec.europa.eu/disschain/asynchronous">
            <ns1:status>
                <ns1:key>98de05ea-540a-43d3-903b-7c9e14faf808</ns1:key>
                <ns1:status>AVAILABLE</ns1:status>
            </ns1:status>
        </ns0:asyncResponse>
    </env:Body>
</env:Envelope>

User guide > Data Browser > Data access via API > API - Detailed guidelines > Asynchronous API 7

Step 3: Get the data

When the results are AVAILABLE, it is possible to to download the data. Data can be obtained via a REST request:

User guide > Data Browser > Data access via API > API - Detailed guidelines > Asynchronous API 6

Errors returned

NO DATA 

In case the query eventually did not contains any statistical value,

<S:Fault xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
    <faultcode>100</faultcode>
    <faultstring>NO_RESULTS: The query that has been sent did not return any results.</faultstring>
</S:Fault>

User guide > Data Browser > Data access via API > API - Detailed guidelines > Asynchronous API 5

DATA NOT YET READY

As long as the data is not ready as informed by the status service call, the returned XML response will be:

<S:Fault>
    <faultcode>100</faultcode>
    <faultstring>DATA_NOT_YET_AVAILABLE: Requested data is not yet available for download. Check the status of your request.</faultstring>
</S:Fault>

User guide > Data Browser > Data access via API > API - Detailed guidelines > Asynchronous API 8

INVALID KEY

If the key provided is not valid, the returned SOAP result will be:

<S:Fault>
    <faultcode>100</faultcode>
    <faultstring>UNKNOWN_REQUEST: Unknown request.</faultstring>
</S:Fault>