Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

muathye's avatar
Level 41

HTTP response status code for update and delete method?

I am building an API endpoints and following RESTful architectural style. but I don't now which response status code perfect for each endpoint Can you help me and the community to build perfect endpoints

please support your answers with references so we can follow up .

0 likes
2 replies
malsowayegh's avatar

I don't think there is a rule for this in REST. to have RESTFUL APIs you have to follow some principles (https://www.ibm.com/topics/rest-apis)

for your case

does the delete or update returns something? if no you can use 204 No Content otherwise I would stick to 200 if its successful

1 like
martinbean's avatar

@muathye Stop overthinking it. Return a 200 OK if the update request was successful and returns the updated resource. Return a 204 No Content response when a delete request is successful (as there’s nothing to return if the resource has been deleted successfully).

1 like

Please or to participate in this conversation.