api - What is the appropriate HTTP status code to ask a client to redo an operation -


i have endpoint on web application takes data client , once enough data collected, operation performed. if result of operation invalid, need inform client operation must redone.

i send response sort of flag in it, if status code exists purpose already, i'd rather utilize it.

looking @ definitions of status codes here, seems there not 1 appropriate, however, if take names account , not descriptions, status code 406 not acceptable sounds appropriate.

406 not acceptable not appropriate because status code content negotiation:

the 406 (not acceptable) status code indicates target resource not have current representation acceptable user agent, according proactive negotiation header fields received in request (section 5.3), , server unwilling supply default representation. -- https://tools.ietf.org/html/rfc7231#section-6.5.6

202 accepted seems better:

the 202 (accepted) status code indicates request has been accepted processing, processing has not been completed. -- https://tools.ietf.org/html/rfc7231#section-6.3.3

... not sure status code's purpose matches yours:

the 202 response intentionally noncommittal. purpose allow server accept request other process (perhaps batch-oriented process run once per day) without requiring user agent's connection server persist until process completed. -- https://tools.ietf.org/html/rfc7231#section-6.3.3

usually http responses not explicitly request user agent send additional information. status code know 401 unauthorized requests authorization header. may need design own status code purpose. please consult people @ http working group mailing list.


Comments

Popular posts from this blog

java - Oracle EBS .ClassNotFoundException: oracle.apps.fnd.formsClient.FormsLauncher.class ERROR -

c# - how to use buttonedit in devexpress gridcontrol -

nvd3.js - angularjs-nvd3-directives setting color in legend as well as in chart elements -