Reputation: 2450
I'm new to REST API development and I haven't been able to find any guidance on what to do if you don't want to support all the operations.
For instance, say I wanted to make a read-only API, what do I do if I recieve one of the "write" verbs (PUT, POST, DELETE, etc.)? Is there a convention for this (like return a 404, or a 500, or something)?
Upvotes: 2
Views: 130
Reputation: 142014
405 is for method that is not supported by a resource. 501 is when your server does not recognize the method. I believe the error is a 4xx not a 5xx because it is the client that requested something that it is not allowed to do. The client can fix this. The server is not at fault, it simply chose not to implement that method.
Upvotes: 1