What HTTP status code should I use for nickname validation?

mvpasarel

I am building an API and one of the endpoints is about nickname validation for a company. I read a lot about HTTP status codes and for entity validation 422 seems the best choice. How about one field validation as in my example?

Tim

What HTTP status code should I use for nickname validation?


For example it already exists

I think 409 Conflict is an appropriate pick

The 409 (Conflict) status code indicates that the request could not be completed due to a conflict with the current state of the target resource. This code is used in situations where the user might be able to resolve the conflict and resubmit the request. The server SHOULD generate a payload that includes enough information for a user to recognize the source of the conflict.

User 1 picked a username, User 2 wants the same, but can't, because it conflicts with User 1's username

or has not allowed chars

For this, 422 Unprocessable Entity as you mentioned seems ok.

The 422 (Unprocessable Entity) status code means the server understands the content type of the request entity (hence a 415(Unsupported Media Type) status code is inappropriate), and the syntax of the request entity is correct (thus a 400 (Bad Request) status code is inappropriate) but was unable to process the contained instructions. For example, this error condition may occur if request body contains well-formed (i.e., syntactically correct), but semantically erroneous, instructions.

Emphasis mine

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

What HTTP status code should I use for nickname validation?

From Dev

What http status code should I use when customer configuration is not correct?

From Dev

What status code should I use when session token is invalid?

From Dev

What should be the Http Status code for Request pending?

From Dev

What HTTP status code should I return for POST when no resource is created?

From Dev

What Http response code should I return for validation-only API methods?

From Dev

What Http response code should I return for validation-only API methods?

From Dev

When redirecting from http to https, which status code should I use?

From Dev

Which HTTP status code should I use for a health-check failure?

From Dev

what should be HTTP status code if resource is not available for requested action?

From Dev

what should be HTTP status code for credentials Expired error/exception?

From Dev

what should be HTTP status code if resource is not available for requested action?

From Dev

What should I use as a hash code of null?

From Dev

What should I use as a hash code of null?

From Dev

What HTTP error code should I use when trying to insert an already existing object?

From Dev

What HTTP status code to use for 'account required' pages?

From Dev

What HTTP response status code to use for unrelated redirects of random chance?

From Dev

HTTP status code 202 or 303. When I need use it?

From Dev

What should I use for this?

From Dev

HTTP Status Code 206: When should it be used?

From Dev

Validation of incoming XML - should I use both a XSD file and in code validation

From Dev

What http status code should the Web API return for a business rule failure?

From Dev

What code skeleton should I use for Intel 8086 DOS assembly?

From Dev

what code I should use for Internet explorer to rotate my image

From Dev

What artefact repository I should use for continuous integration in c code?

From Dev

what code should I use to open a link or file in CGI perl

From Dev

What status code should I response with when there is no data found in my database

From Dev

What is the HTTP status code for License limit reached

From Java

Should I use JSLint or JSHint JavaScript validation?

Related Related

  1. 1

    What HTTP status code should I use for nickname validation?

  2. 2

    What http status code should I use when customer configuration is not correct?

  3. 3

    What status code should I use when session token is invalid?

  4. 4

    What should be the Http Status code for Request pending?

  5. 5

    What HTTP status code should I return for POST when no resource is created?

  6. 6

    What Http response code should I return for validation-only API methods?

  7. 7

    What Http response code should I return for validation-only API methods?

  8. 8

    When redirecting from http to https, which status code should I use?

  9. 9

    Which HTTP status code should I use for a health-check failure?

  10. 10

    what should be HTTP status code if resource is not available for requested action?

  11. 11

    what should be HTTP status code for credentials Expired error/exception?

  12. 12

    what should be HTTP status code if resource is not available for requested action?

  13. 13

    What should I use as a hash code of null?

  14. 14

    What should I use as a hash code of null?

  15. 15

    What HTTP error code should I use when trying to insert an already existing object?

  16. 16

    What HTTP status code to use for 'account required' pages?

  17. 17

    What HTTP response status code to use for unrelated redirects of random chance?

  18. 18

    HTTP status code 202 or 303. When I need use it?

  19. 19

    What should I use for this?

  20. 20

    HTTP Status Code 206: When should it be used?

  21. 21

    Validation of incoming XML - should I use both a XSD file and in code validation

  22. 22

    What http status code should the Web API return for a business rule failure?

  23. 23

    What code skeleton should I use for Intel 8086 DOS assembly?

  24. 24

    what code I should use for Internet explorer to rotate my image

  25. 25

    What artefact repository I should use for continuous integration in c code?

  26. 26

    what code should I use to open a link or file in CGI perl

  27. 27

    What status code should I response with when there is no data found in my database

  28. 28

    What is the HTTP status code for License limit reached

  29. 29

    Should I use JSLint or JSHint JavaScript validation?

HotTag

Archive