If someone is trying to create a resource using POST for an already existing resource what should be the HTTP Status code usually used ?
e.g.
Create a User with same username / email.
What is the REST API Design best practice normally followed?
409 Conflict can be used. Per as per the w3c guidelines 409 is to be used only in case of PUT : https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html
@Swapnil Raverkar 409 would be the correct status code.
The documentation states that it's used most likely in the case of PUT.
Here's a similar discussion on stackoverflow:
409 is the correct status code for duplicate resource or resource already exists.
User | Count |
---|---|
2 | |
1 | |
1 | |
1 | |
1 |