Skip to content

Retrieve Response Asynchronously

All the request max lifetime is 25 seconds. If any request will be taken more than 25 seconds then you can retrieve the response asynchronously by using given retrieve url.

Work flow

ClientApplicationsend the requesttimeout is 25 secondsresponse [Http Status 200]retrieve id [Http Status 202] with fetch urlfetch request with retrievetimeout is 25 secondsresponse [Http Status 200]response not yet ready [Http Status 202] with fetch urlalt[response is ready][response is not yet ready]loop[until response received or allowed max time limit isreached]max allowed fetch is 3 minuteserror response [Http Status 500]alt[response not processed within allowed max time limit]alt[request received within time][request not received within time]ClientApplication



Request flow

First request

If any request taken more than allowed time limit, You'll be able to see response like below. Request HTTP status will be 202.

Request timeout response
{
    "meta": {
        "success": true,
        "statusCode": 2,
        "statusMessage": "FETCH LATER",
        "actionType": "",
        "conversationId": "fe22cb8d-67e9-4c29-92af-e44dffdcb9a9"
    },
    "asyncFetch": {
        "fetchUrl": "/api/v1/fetch/reservation/flight-book?retrieveId=6b9f08b6-556a-4d08-a8e2-3bb50eee550c",
        "message": "Please use this url to fetch the response later."
    },
    "version": "1.0.0"
}

Fetch(retrieve) request

You'll need to use fetchUrl given in the response to fetch the original response.

If response is ready when you're trying to fetch, You'll be able to see the actual response message.

if request still not yet ready, You'll be able to see a response like below. Request HTTP status will be 202.

Response not yet ready response
{
    "meta": {
        "success": true,
        "statusCode": 3,
        "statusMessage": "NOT YET AVAILABLE",
        "actionType": "",
        "conversationId": "fe22cb8d-67e9-4c29-92af-e44dffdcb9a9"
    },
    "asyncFetch": {
        "fetchUrl": "/api/v1/fetch/flight/search?retrieveId=b5c37e2b-7676-4346-9f3f-4e70d64fab45",
        "message": "Still request in process, Please try again using this url."
    },
    "version": "1.0.0"
}

Until response is ready, You'll have to send this request. Once response is ready you'll be able to take the result.

Failure scenarios

If response not able to process within the allowed time limit(3Min), You'll receive an error response with HTTP status 500.

Also, You'll get an error response with 404 HTTP status, If your retrieveId is invalid or expired.

If you are trying with invalid fetch endpoint which is not returned from the original request, You'll receive an error with 400 HTTP status.