Sunday, 15 April 2012

rest - Most appropriate HTTP status code for "job in progress" -



rest - Most appropriate HTTP status code for "job in progress" -

what appropriate http status code give client mean "your request fine, still in progress; check shortly in exact same place."

for example, client submits initial request start heavy query, , server returns url client can poll periodically result. in case client calls url before job completed, appropriate http status code return?

202 accepted first impulse. best one, or there improve 1 more idiomatic purpose in rest interfaces?

to me, 202 accepted best way go.

see documentation on w3c website.

10.2.3 202 accepted

the request has been accepted processing, processing has not been completed. request might or might not acted upon, might disallowed when processing takes place. there no facility re-sending status code asynchronous operation such this.

the 202 response intentionally non-committal. purpose allow server take request other process (perhaps batch-oriented process run 1 time per day) without requiring user agent's connection server persist until process completed. entity returned response should include indication of request's current status , either pointer status monitor or estimate of when user can expect request fulfilled.

http rest response httpresponse http-status-codes

No comments:

Post a Comment