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
PUT is a full replacement, not a partial one #445
Comments
|
We support PATCH, let's change it to use that. |
|
One thing to note with this is that it's not so simple to formulate a PATCH payload for rev 1.1 E.g. PUT {"field": "value"}{
"op": "replace",
"path": "/cards/0/links/customer",
"value": "{customer,customers.id}"
}Does PATCH support a simpler syntax for ad-hoc examples? This would be good for CURL examples. (I concede that since client libraries do the heavy lifting this may be a non-issue). |
|
The normie use case is the simplicity of the curl command. I strongly urge that we do not deviate from simple curl commands that people can paste in their terminals. |
|
PATCH supports 'a diff media type.' The details don't matter. Technically, JSON API uses JSON PATCH with PATCH requests currently. That said, PATCH fudging it with the type is better than PUT being straight-up wrong, so it's fine to not be mega ultra orthodox here... |
|
@steveklabnik why not use the diff media type? I want to use hypermedia as much as possible - our internal python frameworks should be updated to handle these cases! |
|
The only diff type that currently exists is JSON PATCH, which has the problem you're talking about with cURL. Someone is/was working on getting TL;DR: it's complicated. That's why I suggested POST. |
|
@steveklabnik So our issue is: vs ? |
|
almost. the PATCH would be You gotta send JSON, not |
|
@steveklabnik should we introduce our own Ideally, you'd pass in an accept header though: |
|
It would have to be |
|
If we did that can we document the content type behavior as not supporting array updates and always having a default operation of replace? E.g. make it so that it behaves the same as the partial PUT that we support now? curl -u ${KEY}: https://api.balancedpayments.com/cards/:card_id \
-H 'Accept: application/www-url-encoded-patch'
-X PATCH \
-d "property=value" |
|
Yes, we could define it however we wanted. |
HTTP Spec nerd-ery time: we're doing PUT wrong. https://docs.balancedpayments.com/1.1/api/cards/?language=bash#update-a-card
This should either be PATCH or POST.
The text was updated successfully, but these errors were encountered: