1

What is a correct RESTful service response to a PUT request on successful update?

There are two possible responses that seem to comply with REST architectural style:

  1. Return only a header without body with the status 204.

    Header:

    content-type: application/json; charset=utf-8
    status: 204 No Content
    ratelimit-limit: 5000
    ratelimit-remaining: 4816
    ratelimit-reset: 1444931833
    
  2. Return a header with the status 200 and a body that contains the actual representation of an entity after an update.

    Header:

    content-type: application/json; charset=utf-8
    status: 200 OK
    ratelimit-limit: 5000
    ratelimit-remaining: 4816
    ratelimit-reset: 1444931833
    

    Body:

    {
      "foo": "bar",
      "baz": "qux"
    }
    
Pavel
  • 4,912
  • 7
  • 49
  • 69

1 Answers1

0

If your response includes returned data then its status should be 200, otherwise 204.

Sjshovan
  • 310
  • 2
  • 5