Is it wrong to return 202 “Accepted” in response to HTTP GET?

后端 未结 4 1410
遇见更好的自我
遇见更好的自我 2020-12-02 16:24

I have a set of resources whose representations are lazily created. The computation to construct these representations can take anywhere from a few milliseconds to a few hou

4条回答
  •  臣服心动
    2020-12-02 16:50

    We did this for a recent application, a client (custom application, not a browser) POST'ed a query and the server would return 202 with a URI to the "job" being posted - the client would use that URI to poll for the result - this seems to fit nicely with what was being done.

    The most important thing here is anyway to document how your service/API works, and what a response of 202 means.

提交回复
热议问题