I have a REST API to manage a booking systemI'm searching how to manage this situation :A customer can book a time slot :A TimeSlot resource is created and linked to a Person resource. In order to create the link between a time lot and a person, the REST client send a POST request on the TimeSlot resourceBut if too many people booked the same slot (let's say the limit is 5 links), it must be impossible to create more associations.How can I handle this business restriction ? Can I return a 404 status code with a JSON response detailing the error with a status code ?Is it a RESTFul approach ?EDIT :Like suggested below I used status 409 Conflict in addition to a JSON response detailing the error
How to handle business rules with a REST API?
api;web services;rest;api design;http
Attention : See the Answer by Cormac Mullhall404 means resource not found. Using it here would be not appropriate. Because the resource clearly exists, but cannot be manipulated. According to Quick Tips (http://www.restapitutorial.com/lessons/restquicktips.html) 409 Conflict would be a good way to go. You can of course return 200 with error message in the body. The client is still responsible for reading responses and act on them.