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
sequenceDiagram
participant c as Client
participant a as Application
c->>a:send the request
note over a:timeout is 25 seconds
alt request received within time
a->>c:response [Http Status 200]
else request not received within time
a->>c:retrieve id [Http Status 202] with fetch url
loop until response received or allowed max time limit is reached
c->>a:fetch request with retrieve
note over a:timeout is 25 seconds
alt response is ready
a->>c:response [Http Status 200]
else response is not yet ready
a->>c:response not yet ready [Http Status 202] with fetch url
end
end
alt response not processed within allowed max time limit
note over a:max allowed fetch is 3 minutes
a->>c:error response [Http Status 500]
end
end
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.
{"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.
{"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.