Managing Resources

Table of contents:

Introduction

Resources can have calendars, one or multiple, that contains events and bookings. If you're a two-sided marketplace, you can also create resources for your consumers/end-users to make mutual availability checks, but it's not required.

Onboarding & resource creation

Timekit can be used without your users even knowing about us, as user/resource creation and provisioning can be done 100% through the API. In the onboarding flow in your app, you can simply add an API call to Timekit where you create the resource (with the email, password, timezone etc. provided through your own screens) and save the resulting API token - more on that below.

With Google connect, the user would however have to accept OAuth permissions manually, but you can control the callback redirect so users are led back to your own app instead of Timekit.

User API tokens (credentials)

Whenever you create a new user/resource (plain user or Google connected), you will receive an API token in the response. We recommend you save this API token in your own database, on your user/resource model, as you will have to use the token for authentication to the Timekit API for all subsequent requests.

1a. Creating plain resources

  1. Create new resource
    Save the "email" and "token" from the response for the next API requests
    POST /resources

  2. Create a new calendar
    The returning calendar ID can be used as a target for creating events/bookings
    POST /calendars

1b. Creating resources/users with Google accounts

  1. Connect Google account to create user
    After the callback, save the "email" and "token" query params for the next API requests
    GET /accounts/google/signup

  2. Sync user's Google calendars to Timekit
    GET /accounts/sync

  3. Get user's calendars
    The calendar IDs can be used as targets for creating events/bookings
    GET /calendars

  4. Specify which calendars to sync for availability
    PUT /calendars/:id

  5. Perform a sync
    GET /accounts/sync

2. Widget credentials

If you're planning to use Booking.js, our UI widget, you'll also need to generate a special API token that can be used publicly client-side. These credentials are locked down for only widget relevant endpoints.

This is done by calling:
POST /credentials

πŸ‘

Next guide

Continue to the next guide and learn how to create and update bookings