I'm developing an API for events management. I have the basic GET and POST methods but now I have to deal with the event resource edition.
A user can edit all the event information using:
- PUT
/event/:eventId
But also it can cancel the event (not deleting it, but changing it's status
property).
I've thinking on using this endpoint:
- PATCH
/event/:eventId
and send a body with only the newstatus
property value.
I think this is a good approach but then I have noticed that the status can only be set to CANCELLED
, the other allowed status for the event are changed automatically in the business logic in certain cases.
So sending the status
field doesn't make sense at all if you only can change it to one possible value.
Therefore, is it possible and not a bad practice to send no body to a PATCH method? Thanks.