TRTH2.0 async post

jim.yu
jim.yu Explorer

If my request is POST with "Prefer":"respond-async", Shall I still check response code 202? Or it is always either 200 or some 4XX code. This is comparing with GET status, you many keep GET until you get 200 code back.

Best Answer

  • Hello @jim.yu

    The overview steps to process async post request are listed below:
    1.send Post request
    2.check the response code:
    2.1 200 => get the result.
    2.2 other code which is not 200 or 202 => get the error.
    2.2 202 => means the result is not ready. Then, extract the location URL in the response headers. Next, execute Get command with the location URL to check the status of the Post request till the response code is not 202 which means the Post request is proceeded completely.
    - if the response code is 200 => get the result
    - Other code => get the error

    For more detail of Async, please refer to Async Key Mechanism

    Hope this help.

Answers