Skip to content

Instantly share code, notes, and snippets.

@n3dst4
Created October 30, 2012 10:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save n3dst4/3979599 to your computer and use it in GitHub Desktop.
Save n3dst4/3979599 to your computer and use it in GitHub Desktop.
Autofiller REST service
-->
POST /tasks/autofiller/101
{
object: {
id: 101,
description: 123,
building: 234,
site: 345,
reporter: 456
},
changedFields: ["reporter"]
}
<--
200 OK
{
object: {
id: 101,
description: 123,
building: 678,
site: 567,
reporter: 456
},
changedFields: ["site", "building"]
}
To autofill an unsaved entity
=============================
POST /tasks/autofiller
PUT vs. POST
============
PUT is guaranteed idempotent, POST does not have to be. Our query is idempotent;
in fact, it's nullipotent. So it could be PUT.
We are not replacing an existing resource or creating a new resource at the given
URL. Suggests POST.
We are arguably creating a new query; the server will probably throw that away
immediately after handling the request, but we can think of it that way. Suggests
POST.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment