Created
November 22, 2016 21:25
-
-
Save kn9ts/54a353de3b8e3d85968db7f4cfdfc84c to your computer and use it in GitHub Desktop.
Example of a REST API convention
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
GET /persons [All persons data in a list] | |
{ | |
success: true, | |
response: [personObject, personObject, personObject, personObject...] | |
} | |
GET /persons/1575 [returns a single person] | |
{ | |
success: true, | |
response: { | |
name: 'Eugene', | |
age: 27, | |
location: 'NY for now' | |
... | |
} // personObject | |
} | |
POST /persons [adds a new single person] | |
{ | |
success: true, | |
response: personObject (with created_at timestamp of actual create time) | |
} | |
PATCH/PUT /persons/1575 | |
{ | |
success: true, | |
response: personUpdatedObject (with modified_at timestamp of actual update time) | |
} | |
DELETE /persons/1575 | |
{ | |
success: true | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment