Creating resources via the API

This article will walk you through creating resources via the API.

d
Written by derrick mak
Updated over a week ago

Note: you can also create resources via our Admin Dashboard. Navigate to "resources" and click "create resource". Login to the Admin here

Its a good idea to have familiarised yourself with Timekits definition of a bookable resource before reading this article.

Introduction

Timekit can be used without your users even knowing, as resource creation and provisioning can be done 100% through the API. As such this tutorial will focus on resource creation solely through the API. 

Save the IDs

As we'll demonstrate further down each resource will have it own unique identifier in the form of a UUID. This UUID is all you need to get up and running, querying for availability and handle bookings.

As per REST conventions you create resources by requesting the /resource endpoint with a POST like so:

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"
  }'

This will create the Doc Brown resource, only the "name" and "timezone" parameters are mandatory, email is not mandatory as its not common for a conference room to have an email address, just to exemplify what a resource could also be.

The above request will produce a response similar to this:

{
  "data": {
    "id": "78a4d873-2a68-41c6-bdd4-c0ca5b35efd3",
    "first_name": "Doc Brown",
    "last_name": "",
    "name": "Doc Brown",
    "email": "doc.brown@timekit.io",
    "timezone": "America/Los_Angeles",
    "calendars": [
      "id": "bfa0b9fa-36aa-4ae6-8096-f3b20fbed1d2"
      "provider_id": null
      "provider_access": "owner"
      "provider_primary": false
      "provider_sync": false
      "name": "Bookings"
      "description": "Created by Timekit on resource creation"
      "foregroundcolor": null
      "backgroundcolor": null
      "created_at": "2017-12-19T09:37:36+0200"
      "updated_at": "2017-12-19T09:37:36+0200"
      "provider": "timekit"
    ]
  }
}

Now you should store the resource's ID 78a4d873-2a68-41c6-bdd4-c0ca5b35efd3 in this case.

Next step

You you're ready to really start using Timekit, by means of our FindTime engine that you query for availability, please read this introduction to availability or just jump right to the tutorial on how you find availability.

Did this answer your question?