-
Notifications
You must be signed in to change notification settings - Fork 1
API Contract
Aaron Tribou edited this page Aug 11, 2015
·
4 revisions
- Guest Status
- Create Guest
- Get One Guest
- Get Current Guests
- Notify Guest
- Complete Guest
- Update Estimate
Possible options:
new
notified
called
completed
cancelled
curl -X POST https://api.example.com/guests \
-H 'Content-Type: application/json' \
-d '{ "guest": { "name": "John Smith", "phone": "5551234567", "estimate": 15 } }'
Status: 201
{
"guest": {
"id": 1,
"estimate": 15,
"name": "John Smith",
"phone": "5551234567",
"status": "new",
"createdAt": "2014-11-14T16:29:21Z",
"updatedAt": "2014-11-14T16:29:21Z",
"estimatedAt": "2014-11-14T16:29:21Z"
}
}
curl -X GET https://api.example.com/guests/1 \
-H 'Content-Type: application/json'
Status: 200
{
"guest": {
"id": 1,
"estimate": 15,
"name": "John Smith",
"phone": "5551234567",
"status": "new",
"createdAt": "2014-11-14T16:29:21Z",
"updatedAt": "2014-11-14T16:29:21Z",
"estimatedAt": "2014-11-14T16:29:21Z"
}
}
curl -X GET https://api.example.com/guests \
-H 'Content-Type: application/json'
Status: 200
{
"guests": [
{
"id": 1,
"estimate": 15,
"name": "John Smith",
"phone": "5551234567",
"status": "new",
"createdAt": "2014-11-14T16:29:21Z",
"updatedAt": "2014-11-14T16:29:21Z",
"estimatedAt": "2014-11-14T16:29:21Z"
}, {
"id": 2,
"estimate": 15,
"name": "Adam Smith",
"phone": "5551235555",
"status": "notified",
"createdAt": "2014-11-14T16:29:21Z",
"updatedAt": "2014-11-14T16:29:21Z",
"estimatedAt": "2014-11-14T16:29:21Z"
}
]
}
curl -X PATCH https://api.example.com/guests/1/notify \
-H 'Content-Type: application/json'
Status: 200
{
"guest": {
"id": 1,
"estimate": 15,
"name": "John Smith",
"phone": "5551234567",
"status": "notified",
"createdAt": "2014-11-14T16:29:21Z",
"updatedAt": "2014-11-14T16:29:21Z",
"estimatedAt": "2014-11-14T16:29:21Z"
}
}
curl -X PATCH https://api.example.com/guests/1/complete \
-H 'Content-Type: application/json'
Status: 200
{
"guest": {
"id": 1,
"estimate": 15,
"name": "John Smith",
"phone": "5551234567",
"status": "completed",
"createdAt": "2014-11-14T16:29:21Z",
"updatedAt": "2014-11-14T16:29:21Z",
"estimatedAt": "2014-11-14T16:29:21Z"
}
}
curl -X PATCH https://api.example.com/guests/1/estimate \
-H 'Content-Type: application/json' \
-d '{ "guest": { "estimate": 20 } }'
Status: 200
{
"guest": {
"id": 1,
"estimate": 20,
"name": "John Smith",
"phone": "5551234567",
"status": "completed",
"createdAt": "2014-11-14T16:29:21Z",
"updatedAt": "2014-11-14T16:45:43Z",
"estimatedAt": "2014-11-14T16:45:43Z"
}
}