Question

So i've got a website that accepts an HTTP-PUT for a particular resource, eg. /contact which will allow the consumer to update a contact, assuming they have passed validation.

So I update the record, all is great .. and now I need to return something to the consumer.

What's the HTTP Status Code I should be returning?

If this was an HTTP-POST (ie. Creating a -new- resource), then I would return an 201 Created and add a Location header attribute.

But .. I can't find any clues about what to do for an Update.

Cheers :)

Was it helpful?

Solution

200 is especially appropriate if you are returning a representation of the action (although the work-in-progress-but-nearing-last-call "HTTP bis" oddly doesn't mention PUT in its description of 200 OK).

If you're not returning any sort of representation, use 204 No Content to indicate to the client that it doesn't need to change its current "document view".

OTHER TIPS

200 is the appropriate status code assuming the PUT only did an update and did not create a resource.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top