2

I have a question regarding the JSON-PATCH format specified in RFC6902.

As I understand this format good for PATCH requests. Is there a way of using this in the response, may be using partial content code? I have a special case in which operations that I request using PATCH could cause additional changes in the resource, and since the resource itself is huge, I don't want to send the complete representation back.

How widely is the format discussed in the RFC is being used?

Robin Green
  • 32,079
  • 16
  • 104
  • 187
Sajith
  • 106
  • 5

1 Answers1

0

I think you can return the partial representation of the updated resource as json, and that will fall in accordance with the specification of PATCH. The JSON-PATCH defines the request, not response. So in response, I think you can just send the partial representation. For example, if you object looks like this:

{
  "a": "b",
  "c": "d"
}

Then, if you have this PATCH request:

PATCH http://<location-of-resource>
{
  "op": "replace", "path": "a", "value": "updated-value"
}

in your response to updating "a" you can send back this:

{
  "a": "updated-value"
}
Victor Pudeyev
  • 4,296
  • 6
  • 41
  • 67