# Create a bookable resource
curl --request POST \
--url https://api.timekit.io/v2/resources \
--header 'Content-Type: application/json' \
--user :live_api_key_7nzvc7wsBQQISLeFSVhROys9V1bUJ1z7 \
--data '{
"email": "doc.brown@timekit.io",
"timezone": "America/Los_Angeles",
"name": "Doc Brown",
"password": "FluxCapacitator",
"tags": [
"time-traveller",
"doctor",
"delorean"
]
}'
Copy
# Find 4-hour available timeslots in the coming 4 weeks
curl --request POST \
--url https://api.timekit.io/v2/availability \
--header 'Content-Type: application/json' \
--user :live_api_key_7nzvc7wsBQQISLeFSVhROys9V1bUJ1z7 \
--data '{
"mode": "roundrobin_random",
"resources": [
"78a4d873-2a68-41c6-bdd4-c0ca5b35efd3"
],
"from": "2 days",
"to": "4 weeks",
"length": "4 hours",
"buffer": "30 minutes"
}'
Copy
# A customer books one of the available times with the resource
curl --request POST \
--url https://api.timekit.io/v2/bookings \
--header 'Content-Type: application/json' \
--user :live_api_key_7nzvc7wsBQQISLeFSVhROys9V1bUJ1z7 \
--data '{
"resource_id": "d187d6e0-d6cb-409a-ae60-45a8fd0ec879",
"graph": "confirm_decline",
"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!",
"meta": {
"latitude":"34.1381168",
"longitude":"-118.3533783"
},
"customer": {
"name": "Marty McFly",
"email": "marty.mcfly@timekit.io",
"phone": "(916) 555-4385",
"voip": "McFly",
"timezone": "America/Los_Angeles"
}
}'
Copy
# The resource cancels the booking
curl --request POST \
--url https://api.timekit.io/v2/bookings/:id/cancel \
--header 'Content-Type: application/json' \
--user :live_api_key_7nzvc7wsBQQISLeFSVhROys9V1bUJ1z7 \
--data '{
"cancel": {
"message": "Sorry, gotta fix a critical issue on the DeLorean, can you please pick a new time?"
}
}'
Copy