Introduction to working with the API

The tools and prerequisite we use in these articles.

d
Written by derrick mak
Updated over a week ago

The tutorials on these pages assumes that you have at least an idea of what a RESTful
API is.

First of all you need to sign up before you can start consuming the API. You sign up here https://admin.timekit.io/login.
You also need to create an App, since all requests to the API are made in the context of an app, defined by the App-Token that you use for authentication.

cURL

All code examples use the cURL command line tool which is a simple and common tool for communicating via HTTP and perfect for consuming RESTful APIs. We've tried our best to make the code examples copy-pastable, so you should basically just replace ID's if you're taking these tutorials for a spin.

JSON

Timekit uses JSON as data-format so all data to and from Timekit must be and will be formatted in JSON. You need to set an HTTP header like this: "Content-Type: application/json" when requesting Timekits API. All our cURL examples have this header included.

RFC3339

The standard timestamp format we use is RFC3339, which is a subset of ISO8601 but RFC3339 is more narrowly defined and thus more to the point. Some programming languages will not have an RFC3339 format but will then have an ISO8601 format that in most cases is RFC3339 compatible.
An RFC3339 timestamp will look like this: 2017-11-24T08:46:01+02:00

Authentication

We use Basic Authentication over HTTPS

App-Token authentication

App-Token authentication is slightly different from traditional basic authentication, in that there is no email or user-name value for the App-Token and so the authentication only uses the token value as you would normally use the password, like so:

curl --request GET \
  --url https://api.timekit.io/v2/bookings \
  --header 'Content-Type: application/json' \  
  --user :live_api_key_7nzvc7wsBQQISLeFSVhROys9V1bUJ1z7

 Notice that there is a prefixing colon on the token-value. That cURL example will respond with all the bookings for the app, identified by the App-Token.

The easiest way to retrieve the App-Token is through our admin-interface. If you for some reason need to obtain the App-Token through the API, please read this tutorial on how to obtain the App-Token

Did this answer your question?