Skip to content

levma/timebutler-api-client

Repository files navigation

Publish

Timebutler API

This is an API for the Timebutler service. It allows one to call the defined endpoints of Timebutler as described here.

Status

This client is not production ready! (Early beta stage and subject to change)

Installation

npm i timebutlar-api-client

Configuation

Provide API keys in the .env file:

  • TIMEBUTLER_API_KEY: needed for standard calls
  • TIMEBUTLER_API_KEY_EXTENDED: optional, only needed for priviledged calls like salaries

Usage

In your Node project:

import { absences, createTimebutlerApiCaller } from "timebutler-api-client";

const apiKey = process.env.TIMEBUTLER_API_KEY;
const caller = createTimebutlerApiCaller(apiKey!);
const result = await absences(caller);

Directly inside a html page (download client.js from Releases):

<script src="client.js"></script>
<script>
  const timebutler = globalThis["TimebutlerApi"];
  const caller = timebutler.createTimebutlerApiCaller("a-timebutler-api-key");
  const result = await timebutler.absences(caller);
</script>