The Poll for Response endpoint is used to check the status of a deal request that has been previously submitted. This allows your application to monitor the progress of the deal asynchronously without needing to maintain a constant connection to the service.
Key Features:
-
Asynchronous Status Updates: This endpoint enables you to periodically check the status of your submitted deal request, ensuring that your application can respond to the outcome promptly.
-
Status Tracking: The response includes the current status of the deal, such as “Pending,” “Completed,” or “Failed,” allowing for dynamic handling based on the latest information.
-
Resource Efficiency: By polling at intervals, rather than maintaining a persistent connection, your application can reduce resource consumption and improve performance.
How It Works:
-
Submit the Initial Deal Request: Begin by submitting your deal request through the appropriate endpoint and note the
dealIdentifier
received in the response. -
Poll Using
dealIdentifier
: Use thedealIdentifier
to poll the status endpoint at regular intervals. -
Handle the Response: Based on the response status, proceed with additional actions such as confirmation, further requests, or error handling.
Example Request:
GET /fx/v1.0/deals/{dealIdentifier} HTTP/1.1
Host: api.fileactive.anzgcis.com
authorisation: Bearer <access_token>
Example Response:
On success, the service will return the current status of the deal request along with relevant details.
{
"dealIdentifier": "MKT-d75a03b5-2d7c-4db0-b30f-bcccc67a4fed",
"status": "COMPLETED",
"currencyPair": "AUD/USD",
"swapPoints": "1.3",
"quoteExpiry": "2019-12-31T11:59:59Z",
"securityType": "HR_EXT",
"responseLegs": []
}
Usage Notes:
-
Tracking: Use the
dealIdentifier
from the response to track the status of the deal. Poll the endpoint periodically until the status is updated to a final state, such as “COMPLETED” or “FAILED.” -
Error Handling: Be prepared to handle common HTTP errors:
- 400 Bad Request: Indicates issues with the request format, such as invalid identifiers or missing required parameters.
- 401 Unauthorised: Occurs when authentication fails, typically due to missing or invalid tokens.
- 404 Not Found: The specified deal is not available, either due to a wrong identifier or polling before the deal is ready.
- 503 Service Unavailable: The service is down or temporarily unavailable; consider retrying the request after some time.