Last active
August 29, 2015 14:20
-
-
Save natbusa/24f62bfd7a6423366fb7 to your computer and use it in GitHub Desktop.
Gist REST Json API
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
// creation flow | |
POST /api/actors | |
{ | |
"data" : { | |
"type": "actors", | |
"attributes": { | |
"type": "threashold", | |
"params": { | |
"threashold": 2.5 | |
} | |
}, | |
"links" : { | |
"trigger": { | |
"linkage" : { "type": "actors", "id":"9"} | |
} | |
} | |
} | |
} | |
// read | |
// meta and id generated server side | |
GET /api/actors/12 | |
{ | |
"data" : { | |
"type": "actors", | |
"id": "12" | |
"attributes": { | |
"type": "threashold", | |
"params": { | |
"threashold": 2.5 | |
} | |
}, | |
"links" : { | |
"trigger": { | |
"linkage" : { "type": "actors", "id":"9", "meta": "http://coral.io/api/actors/9" } | |
} | |
} | |
} | |
} | |
// full modify | |
POST/PUT /api/actors/12 | |
{ | |
"data" : { | |
"type": "actors", | |
"id": "12" | |
"attributes": { | |
"type": "threashold", | |
"params": { | |
"threashold": 2.5 | |
} | |
}, | |
"links" : { | |
"trigger": { | |
"linkage" : { "type": "actors", "id":"5" } | |
} | |
} | |
} | |
} | |
// partial modify the resource | |
PATCH /api/actors/12 | |
{ | |
"data" : { | |
"attributes": { | |
"params": { | |
"threashold": 3.5 | |
} | |
} | |
} | |
} | |
// modify the trigger | |
PATCH /api/actors/12 | |
{ | |
"data" : { | |
"links" : { | |
"trigger": { | |
"linkage" : { "type": "actors", "id":"7" } | |
} | |
} | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment