General rules of response handling
When processing a response, it is necessary to analyze the HTTP response code and the status of the object (if any).
- HTTP 200 with the
succeeded
object status, with similar final status, or with object without a status means the operation succeeded. - HTTP 200 with the
pending
object status means the result of the operation is still unknown. Wait for an incoming status change notification. If this object has no notifications, retry the request with the same data and the same idempotency key, or request information about the object using the GET method. If the status of the object does not change, repeat the request at an increasing reasonable interval (for example, use the Fibonacci sequence). - HTTP 200 with the
canceled
object status or similar final status means operation failed. Analyze the reason why the operation failed. If necessary, request new data from the user, retry the request with a new idempotency key and new data. - HTTP 200 with a status other than
succeeded
,canceled
,pending
means the request was processed successfully. Your actions depend on the value of the received status. - HTTP 4XX means operation failed. Analyze the reason why the operation failed. If necessary, repeat the request with a new idempotency key and new data.
- HTTP 500 means the result of processing the request is still unknown. Retry the request with the same data and the same idempotency key, or request information about the object using the GET method. If the status of the object does not change, repeat the request at an increasing reasonable interval (for example, use the Fibonacci sequence).
See also