Skip to content Skip to main navigation Skip to footer

Q: How do I get results for a pending operation?


If server responds on pending request by status 200 – OK,  the body of the response will have the result inside (server already has the result in cache memory and there is no need to process the file again).

If server responds on pending request by status 202 – Accepted, server will create task and server will begin to process the file. In response HTTP header (in parameter “Location”) there is path for pending resource. In the body there is a ID of pending operation.

  • Polling: Client asks on the pending resource (e.g. “get /pending/{ID}). Server will answer with status 200 and in the body there is a status of operation: “running”. Client will repeat this request periodically with free time gaps until server will respond with 303 – See Other status (in a body there will be status “finished”). In HTTP header of this operation (in parameter “Location”) is a resource path for the operation. It is possible to use operation ID in body of the response. Client will ask for resource “get /done/{ID}”, where the final result will be.
  • WebSocket: Client asks for websocket creation by get /pending/{ID}. In query header there will be the parameters Upgrade, Connection, Sec-WebSocket-Version, Sec-WebSocket-Key. Authentication has to be a part of the header (HTTP basic or Session – according the server setup). Result of asynchronous operation will be send by the server by websocket client – client doesn’t have to ask the server repeatedly.

Example of HTTP header:

GET /pending/ec563083-3d9b-457d-a0ac-24b197bc222f HTTP/1.1
  Upgrade: websocket
  Connection: Upgrade
  Sec-WebSocket-Key: x3JJHMbDL1EzLkh9GBhXDw==
  Sec-WebSocket-Version: 13
  X-SessionID: 258f505c-a6fa-4c3f-8a87-b048874ac6aa