In my ASP.NET WEB API controller, I have exposed actions equivalent to the HTTP verbs :- Post, Put, Get and Delete, as follows:-
- PostLocation
- PutLocation
- DeleteLocation
- GetLocation
- GetAllLocations
The following are the clarifications I need in this regard :-
When Post is used to create a location, and the location already exists, Should I consider it as a PUT operation and modify the resource (or) Return an response code indicating that the resource already exists.
In case i need to return an response code indicating that the resource already exists, then what is the correct HTTPResponseCode that should be used and what should be given in the response body?
Proper directions regarding the best practices for the recommended HTTPResponse codes for RESTFUL Web APIs are highly appreciated.