I've got an HTTP POST method that has numerous validations. Some mean the request is flat out invalid, and we return a 400 Bad Request
.
However, for some of them, even in the case of the request being invalid, we need to create a resource and return a representation in the body. What would be the correct status code to use?
200 OK
seems wrong because the request was invalid
400 Bad Request
seems wrong because we have created a resource as a result
Edit: the request is to link two objects in the system, in this case a member
to a ticket
. However, even if the request is invalid, for example because the ticket is already assigned to another member, we want to store a record of the request against the ticket
in a 'ticketLink' table with a status of 'ticket-already-assigned', and return that validation message in the response.