-
Notifications
You must be signed in to change notification settings - Fork 538
Description
This issue is a (choose one):
- Problem/bug report.
- Feature request.
- Request for support. Note: Please try to avoid submitting issues for support requests. Use Gitter instead.
Checklist before submitting:
- I've searched for an existing issue.
- I've asked my question on Gitter and have not received a satisfactory answer.
- I've included a complete bug report template. This step helps us and allows us to see the bug without trying to reproduce the problem from your description. It helps you because you will frequently detect if it's a problem specific to your project.
- The feature I'm asking for is compliant with the JSON:API spec.
Description
Bug reports:
When adding a relationship that already exists or multiple relationships of which at least one already exists, the response is a 400 Bad Request and the relationships are not updated/created. In our specific case we expected the API to behave differently and if I am not misinterpreting http://jsonapi.org, the expected response is actually a different one.
To quote http://jsonapi.org/ (http://jsonapi.org/format/#crud-updating-to-many-relationships):
If all of the specified resources can be added to, or are already present in, the relationship then the server MUST return a successful response.
Note: This approach ensures that a request is successful if the server’s state matches the requested state, and helps avoid pointless race conditions caused by multiple clients making the same changes to a relationship.
I have added a Pull Request in #1167.
Please correct me if I am understanding the specs wrong.