Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support PATCH as defined by JSON-API #63

Open
skqr opened this issue Dec 12, 2014 · 1 comment
Open

Support PATCH as defined by JSON-API #63

skqr opened this issue Dec 12, 2014 · 1 comment

Comments

@skqr
Copy link
Contributor

skqr commented Dec 12, 2014

Support for the PATCH method is defined in the JSON-API spec.

This was not added initially because I actually prefer to make partial updates to my resources using PUT, also as defined by JSON-API.

Is this madness? Is this Sparta? Isn't that spitting in the eye of REST?

The answer is meh.

Actually, the most common implementation of PATCH is that of partial PUT updates in JSON-API - and this is wrong.

PATCH is supposed to take a patch document. Think of a git diff kind of thing.

Will Durand, the author of REST APIs with Symfony 2: The Right Way, which used to be the best way until this bundle came along, expresses it beautifully in another post of his blog.

Great frameworks, such as Ruby on Rails, actually implement PATCH the wrong way.

JSON-API implements something similar to what the RFC for a JSON way of describing diffs between resource versions proposes.

This is much more like it. But it's still kind of hard for a client to implement, isn't it? This is why I prefer PUT so far. It's original intended use is not exactly a common case scenario, and I think being flexible within certain sane boundaries is constructive to the development of better and more useful standards.

That said, we still need PATCH to be JSON-API complete. So hack away.

@skqr skqr added this to the Full JSON-API support milestone Dec 12, 2014
@drewclauson
Copy link

What steps need to be taken to implement PATCH? JSON-API removed PUT from their docs and I'd be interested in helping out as I'm working on a application with an Ember front end and Symfony backend and would like to use JSON-API and your bundle seems very much up to the task except for PATCH. Or could this be accomplished through the "ghost" functionality?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants