Timebutler API documentation
The Timebutler RESTful API can be used to automatically request data and process the data with other software.
Requesting the API
The API must be requested using a HTTP POST
request.
Any request needs to use https always, not http.
The URL for all requests is:
https://timebutler.de/api/v1/[...]
The [...] needs to be replaced by the desired API action code. Valid action codes can be found in this documentation below.
For instance the URL could be like this:
Example:
https://timebutler.de/api/v1/absences
Authentication
For authentication and authorization purposes, every API request needs to provide the personal API token as a HTTP post parameter:
Name of the parameter | Value |
---|---|
auth | Your personal API token (retrieve API token ) |
Two API tokens
There are two API tokens with different access rights:
- one API token allows to request the personnel files and salary data
- one API token allows to request the other data
If you want to request one of the following endpoints please use the API token for the personnel files and salary data:
If you want to request any other endpoint please use the other API token.
HTTP response codes
Any response will have a HTTP response code, as follows:
Code | Name | Description |
---|---|---|
200 | OK | All good, response contains requested data. |
400 | Bad request | The request was invalid, e.g. the action code does not exist or is invalid |
401 | Unauthorized | Authentication information missing or invalid or API access has been deactivated by user |
404 | Not found | Invalid URL, Version in request URL not supported, malformed URL |
405 | Method not allowed | Invalid HTTP method for the API URL |
413 | Request Entity Too Large | The number of bytes of the uploaded data is larger than the allowed amount (3 MB). |
500 | Internal server error | Internal server error, please retry later |
Action codes - Overview
The request URL must contain the action code which will determine the kind of action or information you want to execute or request. Valid action codes are:
API action code | Description and URL |
---|---|
absences |
Retrieve absence entries
Returns a list of all absence entries of all users of a certain year. https://timebutler.de/api/v1/absences
|
users |
Retrieve user data
Returns a list of all users. https://timebutler.de/api/v1/users
|
holidayentitlement |
Retrieve holiday entitlement data
Returns a list of all users' holiday entitlement data. https://timebutler.de/api/v1/holidayentitlement
|
workdays |
Retrieve user workdays data
Returns a list of all workdays of all users. https://timebutler.de/api/v1/workdays
|
holidaysets |
Retrieve holiday sets
Returns a list of all holiday sets https://timebutler.de/api/v1/holidaysets
|
worktime |
Retrieve working time entries
Returns a list of working time entries. https://timebutler.de/api/v1/worktime
|
projects |
Retrieve a list of all projects
Returns a list of all projects (from the work time configuration). https://timebutler.de/api/v1/projects
|
projectsimport |
Create, update or delete projects
Offers commans to create, change or delete projects from the project list. https://timebutler.de/api/v1/projectsimport
|
services |
Retrieve a list of all services
Returns a list of all services (from the work time configuration). https://timebutler.de/api/v1/services
|
timeclock |
Virtual time clock
Offers commands for starting, pausing and stopping the virtual time clock. https://timebutler.de/api/v1/timeclock
|
timeimportbyevents |
Import work time entries
Offers commands to import time entries that have been generated by third party time tracking terminals. The time clock events can be imported (start/stop/pause/resume). https://timebutler.de/api/v1/timeimportbyevents
|
personnelfiles |
Request personnel file data
Returns the personnel file data of one or all users. https://timebutler.de/api/v1/personnelfiles
|
salaries |
Request salary data
Returns the salary data of one or all users. https://timebutler.de/api/v1/salaries
|
Action code absences
This action will deliver a list of all absence entries of all users of a certain year. If you do not pass the year as parameter, the absences of the current year will be returned.
Request URL:
https://timebutler.de/api/v1/absences
Request parameters
The following parameters can be passed as HTTP post parameters in the request:
Name of the parameter | Mandatory | Value |
---|---|---|
year | no | Year, 4-digits. For instance: 2023. If the year is invalid or not provided, the current year will be used. |
Response data
The response will contain the requested data, encoded in UTF-8. The data will be returned as CSV (comma separated value). The first line will contain the column titles, subsequent lines will contain the information of one absence entry, separated by semicolons.
The following columns will be returned:
- ID
- From
- To
- Half a day
- Morning
- User ID
- Employee number
- Type
- Extra vacation day
- State
- Substitute state
- Workdays
- Hours
- Medical certificate (sick leave only)
- Comments
- User ID of the substitute
- Columns for the additional entry fields, optional (details see below)
The column "Type" contains the name of the absence type. In order to view the list of absence types, please login as an administrator, then click on the left bottom on "Settings", then below on "More settings", then on the right on "Absence types".
The column "State" may contain the following values:
- Approved
- Done
- In process
- Rejected
- Submitted
The column "Substitute state" may contain the following values:
- Approval pending
- Approved
- Automatically approved
- Denied
- No approval required
Additional entry fields
For every absence type additional entry fields can be configured. For instance for the absence type 'Business trip' the additional entry fields 'Destination' (text), 'Distance in km' (integer) and 'Day of application' (date) could be configured.
The response data will then contain additional columns: for every absence type there will be a column 'Additional entry fields for <absence type>' followed by one column for every additional entry field.
Example:
If the additional entry fields "Destination" and "Distance" have been configured for the absence type "Business trip" and the additional entry fields "Course name" and "Course fee" have been configured for the absence type "Training", then the following columns will be returned:
The default response data columns as described above (see here), then the folowing columns:
- Additional entry fields for 'Business trip'
- Destination
- Distance
- Additional entry fields for 'Training'
- Course name
- Course fee
Action code users
This action will return the user data.
Request URL:
https://timebutler.de/api/v1/users
Request parameters
No additional request parameters are required or available.
Response data
The response will contain the requested data, encoded in UTF-8. The data will be returned as CSV (comma separated value). The first line will contain the column titles, subsequent lines will contain the information of one user, separated by semicolons.
The following columns will be returned:
- User ID
- Last name
- First name
- Employee number
- E-mail address
- Phone
- Mobile phone
- Cost center
- Branch office
- Department
- User type
- Language
- User ID list of the user's manager (comma separated list, in case more than one user ID exists)
- User account locked
- Additional Information
- Date of entry (dd/mm/yyyy)
- Date of separation from company (dd/mm/yyyy)
- Day of birth (dd/mm/yyyy)
The column "User type" may contain the following values:
- Employee
- Manager
- Admin
Action code holidayentitlement
This action will return the users' holiday entitlement data.
Request URL:
https://timebutler.de/api/v1/holidayentitlement
Request parameters
The following parameter can be passed as HTTP post parameter in the request:
Name of the parameter | Mandatory | Value |
---|---|---|
year | no | Year, 4-digits. For instance: 2023. If the year is invalid or not provided, the current year will be used. |
Response data
The response will contain the requested data, encoded in UTF-8. The data will be returned as CSV (comma separated value). The first line will contain the column titles, subsequent lines will contain the information of one user, separated by semicolons.
The following columns will be returned:
- User ID
- Vacation contingent
- Remaining vacation
- Extra vacation days
- Additional vacation for severely challenged persons
- Expired vacation
- Paid out vacation
- Further vacation contingent
Action code workdays
This action will return all working days for all users.
Request URL:
https://timebutler.de/api/v1/workdays
Request parameters
No additional request parameters are required or available.
Response data
The response will contain the requested data, encoded in UTF-8. The data will be returned as CSV (comma separated value). The first line will contain the column titles, subsequent lines will contain the working days information of one user, separated by semicolons.
The following columns will be returned:
- User ID
- Valid from (dd/mm/yyyy)
- Monday working time in minutes
- Tuesday working time in minutes
- Wednesday working time in minutes
- Thursday working time in minutes
- Friday working time in minutes
- Saturday working time in minutes
- Sunday working time in minutes
- ID of the holiday set
Action code holidaysets
This action will return a list of all holiday sets.
Request URL:
https://timebutler.de/api/v1/holidaysets
Request parameters
No additional request parameters are required or available.
Response data
The response will contain the requested data, encoded in UTF-8. The data will be returned as CSV (comma separated value). The first line will contain the column titles, subsequent lines will contain the information of one holiday set, separated by semicolons.
The following columns will be returned:
- ID of the holiday set
- Name of the holiday set
Action code worktime
This action will return all working time entries for a specific month.
Request URL:
https://timebutler.de/api/v1/worktime
Request parameters
The following parameters can be passed as HTTP post parameters in the request:
Name of the parameter | Mandatory | Value |
---|---|---|
year | no | Year, 4-digits. For instance: 2023. If the year is invalid or not provided, the current year will be used. |
month | no | Month from 1 to 12, for instance 2 for February. If the month is invalid or not provided, the current month will be used. |
Response data
The response will contain the requested data, encoded in UTF-8. The data will be returned as CSV (comma separated value). The first line will contain the column titles, subsequent lines will contain the workingtime entries, separated by semicolons.
The following columns will be returned:
- ID of the work time entry
- User ID
- Employee number
- Date (dd/mm/yyyy)
- Start time (hh:mm)
- End time (hh:mm)
- Working time in seconds
- Pause in seconds
- State
- ID of the project
- ID of the service
- Comments
- Auto stopped
The column "State" may contain the following values:
- Done
- Requested
- Accepted
- Rejected
- In process
Action code projects
This action will return a list of all projects (from the work time configuration).
Request URL:
https://timebutler.de/api/v1/projects
Request parameters
No additional request parameters are required or available.
Response data
The response will contain the requested data, encoded in UTF-8. The data will be returned as CSV (comma separated value). The first line will contain the column titles, subsequent lines will contain the working days information of one user, separated by semicolons.
The following columns will be returned:
- ID of the project
- Name
- State
- Budget in hours
- Comments
- Creation date
The column "State" may contain the following values:
- Active
- Inactive
Action projectsimport
Offers commans to create, change or delete projects from the project list.
Request URL:
https://timebutler.de/api/v1/projectsimport
Request parameters
The following parameter need to be passed as HTTP post parameter in the request:
Name of the parameter | Type | Value |
---|---|---|
csvdatafile | File |
The file with the CSV data to import. For more details, see below. |
Format of the CSV file
The CSV file contains the project data. Each line in the CSV file contains one command and one set of project data. The CSV may not contain headers. All lines will be parsed and processed. The delimiter is the semicolon (;).
Each line of the CSV file must contain the following data:
Column / Value | Description | Format / Example |
---|---|---|
First column One of the following commands:
|
The command determines which action shall be taken:
|
On of the 3 commands.
Examples: |
Second column ID of the project |
The ID of the project which shall be updated or deleted. The ID must be provided except in case of the command CREATE (in this case the ID does not need to be provided but if it has been provided, it will be ignored). The list of IDs can be retrieved by calling the action |
The ID of the project
Examples:
|
Third column Name of the project |
The name of the project. No value needs to be provided for the command DELETE. The name may consist of a maximum number of 150 characters. It may not contain carriage returns, line feeds or semicolons. |
The name of the project, alphanumeric
Examples:
|
Fourth column Project active? |
The project can be set to active (new work time entries for this project) or inactive (new work time entries for this not project). |
One of the following two values:
|
Fifth column Project budget in full hours |
The budget for the project in hours. The value may be provided but is not required. If provided, it must be an integer larger or equal 0. |
The project budget in hours
Examples:
|
Sixth column Required to select a service? |
When a user assigns a work time entry to this project, he may have to also select a service or no. |
One of the following two values:
|
Seventh column Comment |
A comment for the project. The comment will be shown to admin users in the edit form for the project list only, not to the employees. It is not necessary to provide a comment. If provided, a maximum of 200 letters are allowed. The value may not contain carriage returns, line feeds or semicolons. |
A comment for the project
Example:
|
Requirements and conditions for the CSV file
- Each line must contain exactly one command and one set of project data
- If the command DELETE is provided, only the ID of the project must be provided. The other columns may remain empty, but must still be provided, so that the number of semicolons must be correct.
- No headers, only lines that contain data
- he maximum size of the CSV file is 3072000 bytes.
CSV file example
Create a project 'Pegasus IV', change the project with the project ID 4711 and delete the project with the project ID 2367:
UPDATE;4711;Zeus;true;;true;
DELETE;2367;;;;;
Response data
The response will contain data as CSV, encoded in UTF-8.
If the input data is missing or could not be read, then the reponse will contain only one line with one error code, for instance CSV_FILE_MISSING_OR_INVALID or CSV_FILE_TOO_LARGE.
If the input data can be processed, then the response will contain one line for each input line.
If the input line has been processed successfully:
If the input line could not be processed:
- The '#n' will be replaced by the line number.
- The [PROJECT-ID] will be replaced by the ID of the project that has been created / changed / deleted.
- The [ERRORCODE] will be replaced by the error code (see below).
For instance, if CSV data with 5 input lines is uploaded, the response could be the following:
line #2: OK;815
line #3: LINE_NOT_READABLE
line #4: OK;5838
line #5: PROJECT_ID_UNKNOWN
Error codes
List of possible error codes:
- INTERNAL_ERROR
- CSV_FILE_MISSING_OR_INVALID
- CSV_FILE_TOO_LARGE
- LINE_NOT_READABLE
- NUMBER_OF_COLUMNS_INCORRECT
- COMMAND_MISSING_OR_INVALID
- PROJECT_ID_MISSING
- PROJECT_ID_INVALID
- PROJECT_ID_UNKNOWN
- PROJECT_NAME_MISSING_OR_INVALID
- PROJECT_ACTIVE_FLAG_MISSING_OR_INVALID
- PROJECT_BUDGET_HOURS_INVALID
- PROJECT_SERVICES_FLAG_MISSING_OR_INVALID
- WORKTIME_ENTRY_FOR_PROJECT_EXISTS_THUS_NO_DELETE
- COMMENT_INVALID_OR_TOO_LARGE
Action code services
This action will return a list of all services (from the work time configuration).
Request URL:
https://timebutler.de/api/v1/services
Request parameters
No additional request parameters are required or available.
Response data
The response will contain the requested data, encoded in UTF-8. The data will be returned as CSV (comma separated value). The first line will contain the column titles, subsequent lines will contain the working days information of one user, separated by semicolons.
The following columns will be returned:
- ID of the service
- Name
- State
- Billable
- Comments
- Creation date
The column "State" may contain the following values:
- Active
- Inactive
Action code timeclock
You can start, pause, resume and stop the virtual time clock of your users.
Request URL:
https://timebutler.de/api/v1/timeclock
Request parameters
The following parameters must be passed as HTTP post parameters in the request:
Name of the parameter | Value |
---|---|
command |
Valid commands are:
|
userid |
The userid of the user for whom you want to control the virtual time clock. You can obtain the list of userids by calling the API action |
projectid (optional) |
The id of the project for this working time entry. The parameter is optional and it will only be read, if the command 'stop' is provided. It will be ignored for all other commands. You can obtain the list of projectids by calling the API action |
serviceid (optional) |
The id of the service for this working time entry. The parameter is optional and it will only be read, if the command 'stop' is provided. It will be ignored for all other commands. You can obtain the list of serviceids by calling the API action |
Response data
The response will contain one of the following values (please see also the response data for the command status
below):
Response data for command status
The command status
will return more data than the other commands. The response will contain the requested data, encoded in UTF-8. The data will be returned as CSV (comma separated value). The first line will not contain the column titles but the response data, separated by semicolons, as follows:
The following columns will be returned:
- Result code: For instance
OK
orRESULT_ERR_USERID_INVALID
(see table above) - Status:
IDLE
= time clock is not runningRUNNING
= time clock is runningPAUSED
= time clock paused
- Start of the time clock: Timestamp in milliseconds since 1/1/1970 (if the time clock is not running and not paused, the return value will be 0)
- Start of the current pause:Timestamp in milliseconds since 1/1/1970 (if the time clock is not paused, the return value will be 0)
Example:
Action code timeimportbyevents
Offers commands to import time entries that have been generated by third party time tracking terminals. The time clock events can be imported (start/stop/pause/resume). Timebutler will create the work time entries that correspond to thetime clock events.
Request URL:
https://timebutler.de/api/v1/timeimportbyevents
Request parameters
The following parameters need to be passed as HTTP post parameters in the request:
Name of the parameter | Type | Value |
---|---|---|
useridentification | HTTP Parameter |
In order to assign the imported data to the user accounts, the CSV data must contain either the email address or the employee number of the user. With this parameter you can notify whether the CSV data will contain the email address or the employee numer, as follows: Parameter value Parameter value |
csvdatafile | File | The file with the CSV data to import. For more details, see below. |
Format of the CSV file
The CSV file contains the data of the time clock events. Each line in the CSV file contains one event for one employee. The CSV may not contain headers. All lines will be parsed and processed. The delimiter is the semicolon (;).
Each line of the CSV file must contain the following data:
Column / Value | Description | Format / Example |
---|---|---|
First column Email address or employee number of the user |
The request parameter "useridentification" (see above) determines whether this column will contain the email address or the employee number. Once set, the CSV file must either always contain the email address in this column or the employee number. |
Email address or employee number Examples: |
Second column Timestamp |
Date and time, when the event occurred (to-the-minute). |
Examples:
|
Third column One of the following event types
|
The event type determines, which event occurred on the given timestamp:
|
One of the 4 event types.
Examples: |
Fourth column The id of the project for this working time entry. |
The parameter is optional and it will only be read, if the event type You can obtain the list of projectids by calling the API action |
Examples: |
Fifth column The id of the service for this working time entry. |
The parameter is optional and it will only be read, if the event type You can obtain the list of serviceids by calling the API action |
Examples: |
Sixth column The comments for this working time entry. |
The parameter is optional and it will only be read, if the event type The comments must be provided in one line and no line breaks can be added. Also, the semicolon cannot be used, because it separates the columns in the CSV file. |
Example: |
Requirements and conditions for the CSV file
- Each line must contain exactly one event
- No headers, only lines that contain data
- The events must be listed in chronological sequence, starting with the oldest and ending with the newest event
- For a user the START event must be the first entry, then PAUSE or RESUME may follow and finally a STOP entry must be provided. One file may contain several of those event groups for the same or different users.
- The lines for one user must not necessarily be one below the other - instead the events from different users can be listed, as long as the chronological sequence is guranteed.
- If an event group for one user does not end with a STOP event, then the events of this event group will be ignored (for instance start at 9:45 o'clock, pause at 12:03 o'clock and no further events after that).
- Within one event group the START and STOP event must not exceed two calendar days.
- The maximum size of the CSV file is 3072000 bytes.
CSV file examples
One work time entry from 9:43 o'clock until 17:33 o'clock with one pause between 11:45 o'clock and 12:17 o'clock, assigned to the project id 4711 and the service id 733, for one user:
sarah@example.com;2024-02-27T11:45;PAUSE
sarah@example.com;2024-02-27T12:17;RESUME
sarah@example.com;2024-02-27T17:33;STOP;4711;733
Two work time entries for two users, in chronological order. The lines are not sorted by user, which is not a requirement and thus allowed:
tom@example.com;2024-02-27T11:02;START
sarah@example.com;2024-02-27T11:45;PAUSE
sarah@example.com;2024-02-27T12:17;RESUME
tom@example.com;2024-02-27T16:05;STOP;;733;I had to leave early.
sarah@example.com;2024-02-27T17:33;STOP
Response data
The response will contain data as CSV, encoded in UTF-8. If no error occurred during the import, then the HTTP response will contain only 'OK'.
If at least one error occurred during the import, then the HTTP resopnse will contain errors for each line that caused the error, as follows: line #nn: error code
For instance: line #144: TIMESTAMP_INVALID
List of possible error codes:
- INTERNAL_ERROR
- CSV_FILE_MISSING_OR_INVALID
- CSV_FILE_TOO_LARGE
- LINE_NOT_READABLE
- NUMBER_OF_COLUMNS_INCORRECT
- COMMAND_MISSING_OR_INVALID
- PROJECT_ID_MISSING
- PROJECT_ID_INVALID
- PROJECT_ID_UNKNOWN
- PROJECT_NAME_MISSING_OR_INVALID
- PROJECT_ACTIVE_FLAG_MISSING_OR_INVALID
- PROJECT_BUDGET_HOURS_INVALID
- PROJECT_SERVICES_FLAG_MISSING_OR_INVALID
- WORKTIME_ENTRY_FOR_PROJECT_EXISTS_THUS_NO_DELETE
- COMMENT_INVALID_OR_TOO_LARGE
Action code personnelfiles
This action returns the personnel file data of one or several users.
Request URL:
https://timebutler.de/api/v1/personnelfiles
Request parameters
One of the following parameters can be passed as HTTP post parameter in the request. If no parameter is provided, the salary data of all users will be returned.
Parameter | Oligatory | Value |
---|---|---|
no | The email address of the user account, whose data shall be returned. | |
employeenumber | no | The employee number of the user account, whose data shall be returned. |
userid | no |
The user id of the user account, whose data shall be changed. You can obtain the list of userids by calling the API action |
Response data
The response will contain the requested data, encoded in UTF-8. The data will be returned as CSV (comma separated value). The first line will contain the column titles, subsequent lines will contain the personnel data of every user, separated by semicolons.
Every company can configure and rename the fields of the digital personnel file and group them into categories. The following columns will be returned:
- User ID
- Employee number
-
Your individual personnel file field names, as follows:
- Name of the group 1 | Name of the field 1
- Name of the group 1 | Name of the field 2
- Name of the group 1 | Name of the field 3
- Name of the group 2 | Name of the field 1
- Name of the group 2 | Name of the field 2
- Name of the group 3 | Name of the field 1
- Name of the group 3 | Name of the field 2
- etc.
Example
If you configured the groups "Home address" containing the fields "Street", "ZIP code" and "City" and the group "Personal data" containing the fields "Place of birth" and "Marital status", then the following column titles will be returned:
- User ID
- Employee number
- Home address | Street
- Home address | ZIP Code
- Home address | City
- Personal data | Place of birth
- Personal data | Marital status
Action code salaries
This action returns the salary data of one or several users.
Request URL:
https://timebutler.de/api/v1/salaries
Request Parameters
One of the following parameters can be passed as HTTP post parameter in the request. If no parameter is provided, the salary data of all users will be returned.
Parameter | Oligatory | Value |
---|---|---|
no | The email address of the user account, whose data shall be returned. | |
employeenumber | no | The employee number of the user account, whose data shall be returned. |
userid | no |
The user id of the user account, whose data shall be changed. You can obtain the list of userids by calling the API action |
Response data
The response will contain the requested data, encoded in UTF-8. The data will be returned as CSV (comma separated value). The first line will contain the column titles, subsequent lines will contain the salary of every user, separated by semicolons.
The following columns will be returned:
- User ID
- Employee number
- Payment type
- Valid from / Payment date
- Valid until
- Salary type / Bonus type
- Gross amount
- Currency
- Hours per week
- Comments
The column 'Payment type' may contain the following values:
- Salary
- Variable remuneration
- Bonus payments
The column 'Salary type / Bonus type' is a free-text field and may contain any value entered by the user, for instance 'Fixed salary' or 'Bonus payment for exceeding sales goals'.
The column 'Hours per week' can be used to enter the weekly working hours.
The column 'Currency' may contain the following values:
- AUD (Australian dollar)
- BRL (Brazilian real)
- GBP (British pound)
- BGN (Bulgarian lev)
- CAD (Canadian dollar)
- CNY (Chinese yuan renminbi)
- HRK (Croatian kuna)
- CZK (Czech koruna)
- DKK (Danish krone)
- EUR (Euro)
- HKD (Hong Kong dollar)
- HUF (Hungarian forint)
- ISK (Icelandic krona)
- INR (Indian rupee)
- IDR (Indonesian rupiah)
- ILS (Israeli new shekel)
- JPY (Japanese yen)
- MYR (Malaysian ringgit)
- MXN (Mexican peso)
- NZD (New Zealand dollar)
- NOK (Norwegian krone)
- PHP (Philippine peso)
- PLN (Polish zloty)
- RON (Romanian new leu)
- SGD (Singapore dollar)
- ZAR (South African rand)
- KRW (South Korean won)
- SEK (Swedish krona)
- CHF (Swiss franc)
- THB (Thai baht)
- TRY (Turkish lira)
- USD (US dollar)
Code examples
Please replace the XXXXXXX
with your API token.
Curl
curl -X POST 'https://timebutler.de/api/v1/absences' -d 'auth=XXXXXXX'
Python
import requests
url = 'https://timebutler.de/api/v1/absences'
params = {'auth': 'XXXXXXX'}
response = requests.post(url, params=params)
response.text
Java
public String requestTimebutlerApi()
{
String postData = "auth=" + URLEncoder.encode("XXXXXXX", "UTF-8"); // java.net.URLEncoder
String targetUrl = "https://timebutler.de/api/v1/absences";
String responseTxt = "";
URL url = new URL(targetUrl); // java.net.URL
HttpURLConnection connection = (HttpURLConnection)url.openConnection(); // java.net.HttpURLConnection
connection.setRequestMethod("POST");
connection.setUseCaches(false);
connection.setDoOutput(true);
connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
connection.setRequestProperty("Content-Length", String.valueOf(postData.length()));
connection.getOutputStream().write(postData.getBytes("UTF-8"));
BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream(), "UTF-8")); // java.io.BufferedReader
String line;
while ((line = in.readLine()) != null) {
responseTxt += line + "\n";
}
if (connection != null) {
connection.disconnect();
}
return responseTxt;
}
Rust
use reqwest;
fn main() {
request_timebutler_api()
}
fn request_timebutler_api() {
let url = "https://timebutler.de/api/v1/absences";
let params = [("auth", "XXXXXXX")];
let client = reqwest::blocking::Client::new();
let resp = match client
.post(url)
.form(¶ms)
.send() {
Ok(resp) => resp.text().unwrap(),
Err(err) => panic!("Error: {}", err)
};
}
Powershell
$url = "https://timebutler.de/api/v1/absences"
$body = @{
auth = "XXXXXXX"
}
Invoke-RestMethod -Method 'Post' -Uri $url -Body $body -ContentType "application/x-www-form-urlencoded"
# If you want the output to be written into a file just add the following parameter to the last line above: -OutFile output.csv
Google Apps Script
function requestAbsences() {
var apiUrl = "https://timebutler.de/api/v1/absences";
var authtoken = "XXXXXXX";
var formData = {
'auth': authtoken
};
var options = {
'method' : 'post',
'payload' : formData
};
try {
var response = UrlFetchApp.fetch(apiUrl, options);
var responseData = response.getContentText();
}
catch (e) {
Logger.log(e);
}
};
Powerquery
let
ApiKey = "XXXXXXX",
baseUrl = "https://timebutler.de/api/v1/absences",
headers = [#"Content-Type" = "application/x-www-form-urlencoded"],
postData = "auth=" & ApiKey,
response = Web.Contents(
baseUrl,
[
Headers = headers,
Content = Text.ToBinary(postData)
]
),
csvResponse = Csv.Document(response, [Delimiter=";"]),
#"PromoteHeader" = Table.PromoteHeaders(csvResponse, [PromoteAllScalars=true])
in
#"PromoteHeader"
VBA (Excel, ...)
Sub requestTimebutlerApi()
Set objHTTP = CreateObject("MSXML2.ServerXMLHTTP")
URL = "https://timebutler.de/api/v1/absences"
objHTTP.Open "POST", URL, False
objHTTP.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
objHTTP.Send ("auth=XXXXXXX")
replyTXT = objHTTP.responseText
If objHTTP.Status = "200" Then 'success
MsgBox replyTXT
Else
MsgBox objHTTP
End If
End Sub