POST /bookings
Create booking
Create a new booking tied to the current user/resource (usually provider/vendor).
If you include the action key in the request, the specified action will be run automatically. Note that actions usually require input data, like the create action in both the confirm_decline and instant graphs - it's dependent on event and customer data being passed.
Endpoint
POST https://api.timekit.io/v2/bookings
Parameters
| Name | In | Type | Required | Default | Description |
|---|---|---|---|---|---|
graph |
body | string | yes | Name of the flow graph you want to use | |
event |
body | object | yes | Event details (dependending on the chosen graph!) | |
customer |
body | object | yes | Customer info (dependending on the chosen graph!) | |
action |
body | string | Optional name of action that should be triggered right after creation | ||
includes |
query | string | Include booking attributes such as event_info in the response | ||
Timekit-App |
header | string |
Request examples
json{
"graph": "confirm_decline",
"action": "create",
"event": {
"start": "1955-11-12T21:30:00-07:00",
"end": "1955-11-12T22:15:00-07:00",
"what": "Catch the lightning",
"where": "Courthouse, Hill Valley, CA 95420, USA",
"calendar_id": "bfa0b9fa-36aa-4ae6-8096-f3b20fbed1d2",
"description": "The lightning strikes at 10:04 PM exactly! I need you to be there Doc!"
},
"customer": {
"name": "Marty McFly",
"email": "marty.mcfly@timekit.io",
"phone": "(916) 555-4385",
"voip": "McFly",
"timezone": "America/Los_Angeles"
}
}
curlcurl -X POST \
-H 'Timekit-App: back-to-the-future' \
-u doc.brown@timekit.io:nvHfRSlhvsnlg4rS7Wt28Ty47qdgegwSu3YK7hPW \
-d '{
"graph": "confirm_decline",
"action": "create",
"event": {
"start": "1955-11-12T21:30:00-07:00",
"end": "1955-11-12T22:15:00-07:00",
"what": "Catch the lightning",
"where": "Courthouse, Hill Valley, CA 95420, USA",
"calendar_id": "bfa0b9fa-36aa-4ae6-8096-f3b20fbed1d2",
"description": "The lightning strikes at 10:04 PM exactly! I need you to be there Doc!"
},
"customer": {
"name": "Marty McFly",
"email": "marty.mcfly@timekit.io",
"phone": "(916) 555-4385",
"voip": "McFly",
"timezone": "America/Los_Angeles"
},
"settings": {
"allow_double_bookings": true
}
}' \
https://api.timekit.io/v2/bookings
Response examples
200
json{
"data": {
"id": "58190fc6-1ec0-4ebb-b627-7ce6aa9fc703",
"graph": "confirm_decline",
"state": "tentative",
"completed": false,
"created_at": "2016-02-11T11:58:45+0100",
"updated_at": "2016-02-11T11:58:47+0100",
"available_actions": [
"decline",
"confirm"
],
"attributes": {
"event_info": {
"start": "1955-11-12T21:30:00-07:00",
"end": "1955-11-12T22:15:00-07:00",
"what": "Catch the lightning",
"where": "Courthouse, Hill Valley, CA 95420, USA",
"description": "The lightning strikes at 10:04 PM exactly! I need you to be there Doc!"
}
},
"calendar": {
"id": "bfa0b9fa-36aa-4ae6-8096-f3b20fbed1d2",
"name": "Important encounters with Marty",
"display_name": "Important encounters with Marty",
"description": "Througout time, Marty and I really need to meet in order for the world not to collapse into Biffy cazyness.",
"foregroundcolor": "#000000",
"backgroundcolor": "#FFFFFF",
"created_at": "2016-02-15T13:21:42+0100",
"updated_at": "2016-02-15T13:21:42+0100"
},
"customers": [
{
"id": "a728e860-99c7-4009-8843-7d9ac5d7f53f",
"name": "Marty McFly",
"email": "marty.mcfly@timekit.io",
"phone": "(916) 555-4385",
"voip": "McFly",
"timezone": "America/Los_Angeles"
}
]
}
}