No HTTP 303 required to point to uri: pendingOperation-related response as opposed to uri: operationResponse?
spec does not explicitly say this is required, but I tend to agree with you.
Does HTTP 303 use in this way considered harmful? If not, why?
I think that you lose opportunities by doing 303. Although it is “good” to automatically redirect when this is done, it makes it impossible for you to provide metadata around the results that can be used for reporting, etc. Also, many clients do not automatically follow 303, so the client may need to do the work to follow the 303 Location header.
Is this the best we can do, or is there a better way?
I tend to recommend returning a GET uri:pendingOperation return 200 with the status of the resource always with reference to the output when it is "completed". Something like
In case of incomplete
{ "status" : "PENDING" }
On error
{ "status" : "COMPLETE" "errors" : [ { "typeId" : "OPERATION_TIMEOUT", "description" : " "The request was unable to complete because the systems are unresponsive". } ] }
When successful
{ "status" : "COMPLETE" "links" : { "result" : { "href" : "http://api.example.com/finished-resource/1234", } ] }
Daniel Roop
source share