Skip to content
This repository has been archived by the owner on Jan 17, 2023. It is now read-only.

Implement PATCH/POST on /data/ #244

Closed
ianb opened this issue Mar 27, 2015 · 2 comments
Closed

Implement PATCH/POST on /data/ #244

ianb opened this issue Mar 27, 2015 · 2 comments
Milestone

Comments

@ianb
Copy link
Contributor

ianb commented Mar 27, 2015

I'd like to send updates to the server. I'm thinking we keep /data/{id} for the place to set the JSON, but we add a PATCH/POST method (some libraries might make PATCH hard, I'm not sure, and we're just pretending to have a diff document, so admitting that it's just an ad hoc POST seems okay). Also sdk Request doesn't seem to support PATCH.

I propose POST /data/{id} would:

  • Return 404 if the resource doesn't exist (or maybe something else – this might be somewhat common depending on how we code things, and I know ops hates expected 4xx errors – maybe 412 Precondition Failed would be better)
  • Return 200 OK if it goes okay, or maybe 204
  • Takes a JSON document request body. Mimetype we could make up (we would be somewhat compelled to do so for PATCH), or just call it JSON.

The JSON contains properties, each of which overwrites the old property. We will use null in place of actually deleting properties (it's equivalent in the client code). Only for the .clips property, we will look more deeply, adding properties from that object to the existing properties. A null value (e.g., {clips: {"93a938f": null}}) will imply the clip should be deleted.

@ianb ianb added this to the The Shallow MVP milestone Mar 27, 2015
@ianb
Copy link
Contributor Author

ianb commented Mar 28, 2015

Maybe to be explicit we should wrap the whole object, like:

{
  update: {
    userTitle: "Custom title"
  }
}

That leaves room for some other things, like we could do property-level locking like:

{
  expect: {
    userTitle: "Custo title"
  },
  update: {
    userTitle: "Custom title"
  }
}

@ianb ianb modified the milestones: Next Tasks, The Shallow MVP May 14, 2015
@ianb ianb modified the milestone: Next Tasks Jul 14, 2015
@ianb
Copy link
Contributor Author

ianb commented Aug 26, 2016

Current uses aren't chatty here, so this isn't very important.

@ianb ianb closed this as completed Aug 26, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant