Created
October 30, 2012 10:53
-
-
Save n3dst4/3979599 to your computer and use it in GitHub Desktop.
Autofiller REST service
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--> | |
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