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

REST: inconsistent use of PATCH and PUT #218

Open
yvespp opened this issue Nov 7, 2017 · 0 comments
Open

REST: inconsistent use of PATCH and PUT #218

yvespp opened this issue Nov 7, 2017 · 0 comments

Comments

@yvespp
Copy link
Member

yvespp commented Nov 7, 2017

We inconsistently use PATCH and PUT to update a resource. We use PATCH and PUT when only the value of a field can be sent. We use PATCH to send partial resources and only the value. Deployment API:

  • PATCH /deployments/{id : \d+}/confirm: a partial deployment resource can be sent
  • PATCH /deployments/{id : \d+}/date: only a int can be sent
  • PUT /deployments/{id : \d+}/state: only a string can be sent
  • PUT /deployments/{id : \d+}/updateState: only a string can be sent
  • PUT /deployments/{id: \d+}/jobs/{nodeJobId: \d+}: only a string can be sent

The recommendation seems to be to use PUT if the whole resource is sent and PATCH when only some fields are sent. PUT should be idempotent. PATCH should define it's own media type (content-type):

Commands should be POSTed to a subresource and a 303 pointing to the original resource should be returned (e.g. copyFrom resource):

Sending only values doesn't seem to a commonly used pattern.

We should agree on when to use what and cleanup the rest api accordingly.

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

No branches or pull requests

1 participant