What is the REST way to check if resource exists or not? Let say you have some resource called Project. By my understating one of this would be the way :
GET the resource
GET /rest/projects/123
GET /rest/projects/someCriteria
GET /rest/projects/listOfIds
simple but this way the entire object is retrieved if available and we just want to check if it is there. Is there more elegant solution, maybe using HEAD?
The REST way is to use whatever the uniform interface allows in your specific architecture. For HTTP the best match is HEAD
. If you need information beyond the simple existence of a resource, consider OPTIONS
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With