I could use some help interpreting the intention of the spec with regards to the proper response when updating a To-Many relationship. I am concerned with two cases:
- The update is successful and the resulting relationship members exactly match the relationship members given in the request. e.g. a
POSTwhere no new members were added to the relationship.
- The update is successful, but the resulting relationship members are a superset of those provided in the request. e.g. a
POSTwhere a new member is added to a set of one or more existing relationship members.
There is one sentence in particular that I am uncertain about and is hindering my understanding of what the proper response for these cases should be:
A server MUST return a 200 OK status code if an update is successful, the client’s current data remain up to date, and the server responds only with top-level meta data.
I can read this one of two ways. On my first reading I interpreted it as meaning the server returning
200 is dependent on the update being successful and the client’s data remaining up to date and the server responding with only top-level meta data. This reading of it seems to conflict with the description for the
204 response: “…and the representation of the resource in the request matches the result” and the final clause of the sentence would imply the response is dependent on the response itself which would be very confusing.
I’m hoping this is just a case of ambiguity due to choice of punctuation. I rewrote the previous sentence this way to eliminate the ambiguity:
A server MUST return a 200 OK status code if an update is successful. The client’s current data remain up to date and the server responds only with top-level meta data.
Assuming that my second interpretation is the correct one, then my understanding is the response for
1. should be
204 and the response for
2. should be
200, but the response body should not include the representation of the updated relationship members.
Can anyone confirm which interpretation is correct and if I’ve understood the correct response for the two cases outlined? Thanks.