What HTTP code should REST return for a resource that is not ready after code 202?

It seems I can not find the answer to this question. You have a service that, when something is published, gets queued for processing with response code 202. The standard says to provide a pointer to a status monitor, which I did, but what should I return if the client goes to the resource before how will the resource be ready? I think 404, except that the resource exists, is just not processed yet.

Thoughts?

+4
source share
1 answer

Mark this post:

When the client checks the status URI later, if the element is still awaiting a response, then the status URI can return a 200 OK response with the body of the object describing it. If the resource was created, then perhaps the status URI will return a 201 Created response with a Location header indicating the location of the new resource. If the item was not created for some reason, the status URI may return a 410 Gone response. In this case, you should include the body of the object explaining why the resource has left, i.e. "We were unable to create this resource due to processing errors." A 404 Not Found answer will also be acceptable, but a 410 Gone answer implies persistence; The requested resource is gone forever.

It seems relatively reasonable to me, except that the Location header of the IMO header is not particularly suited for this particular purpose.

+1
source

All Articles