Advanced Microservices: thomashunter.name/ms
POST /v1/animal HTTP/1.1\n <-- Request Line Host: api.example.org\n <-- Request Headers Accept: application/json\n Content-Type: application/json\n Content-Length: 24\n \n <-- Two Newlines {\n <-- Body "name": "Gir",\n "animal_type": "12"\n }\n
/collection/collection/{resource_id}/collection/{resource_id}/sub/collection/{resource_id}/sub/{id}GET /collection?filtersGET /collection/{resource_id}?fieldsPOST /collectionDELETE /collection/{resource_id}PUT /collection/{resource_id}
PATCH /collection/{resource_id}
HEAD /endpoint
OPTIONS /endpoint
Accept: Content Types the client acceptsAccept-Language: Language expected by clientContent-Length: Length of request bodyContent-Type: Type of data if a body is presentHost: For virtual hosting, usually ignored by appUser-Agent: Information about clientHTTP/1.1 200 OK\n <-- Status Line Date: Wed, 14 Jun 2017 23:23:01 GMT\n <-- Response Headers Content-Type: application/json\n Access-Control-Max-Age: 1728000\n Cache-Control: no-cache\n \n <-- Two Newlines {\n <-- Body "id": "12",\n "created": "2017-06-14T23:22:59Z",\n "modified": null,\n "name": "Gir",\n "animal_type": "12"\n }\n
101 Switching Protocols200 OK201 Created202 Accepted (e.g. asynchronous creation)204 No Content301 Moved Permanently302 Found307 Temporary Redirect308 Permanent Redirect400 Invalid Request401 Unauthorized403 Forbidden404 Not Found405 Method Not Allowed406 Not Acceptable500 Internal Server Error501 Not Implemented503 Service Unavailable (e.g. no database)521 Web Server Is DownCache-Control: Cache policy, e.g. no-cacheContent-Language: E.g. en-USContent-Length: Response body length in bytesContent-Type: E.g. application/jsonDate: Date and time on the serverExpires: Time when content should expireServer: Useless field for bragging{
"strings": "value",
"numbers": 12,
"moreNumbers": -0.1,
"booleans": true,
"nullable": null,
"array": [1, "abc", false],
"object": { "very": "deep" }
}
snake_case: The most bytesPascalCase: The most shiftscamelCase: Happy mediumenabled instead of disabledpublic instead of privateis_cool or cool_flag, just cool"2017-06-15T04:23:46+00:00""2017-06-15T04:23:46Z""2017-06-15T04:23:46.987Z"1493268311123https://api.example.org/v1/*Accept: application/json+v1X-Api-Version: 1{
"error": "database_connection_failed",
"error_human": "Unable to establish database connection",
"data": null
}
{
"error": null,
"error_human": null,
"data": [{"id": "11"}, {"id": "12"}],
"offset": 10,
"per_page": 10
}
{
"data": [{
"type": "articles", "id": "1",
"attributes": {
"title": "Article Title", "body": "Content"
},
"relationships": {
"author": { "data": {"id": "42", "type": "people"} }
}
}],
"included": [{
"type": "people", "id": "42",
"attributes": { "name": "John", "age": 80 }
}]
}
{
user(id: "tlhunter") {
id
name
photo {
id
url
}
friends {
id
name
}
}
}
{
"data": {
"user": {
"name": "Thomas Hunter II",
"id": "tlhunter",
"photo": { "id": "12", "url": "http://im.io/12.jpg" },
"friends": [
{ "name": "Rupert Styx", "id": "rupertstyx" }
]
}
}
}
{
"id": "tlhunter",
"xyz": [1,2,3]
}
82 a2 69 64 a8 74 6c 68 75 6e 74 65 72 a3 78 79 7a 93 01 02 03
{"jsonrpc":"2.0","method":"subtract","params":[42,23],"id":1}
{"jsonrpc": "2.0", "result": 19, "id": 1}