API
Endpoints
Test
https://test.treks.se
Production
https://app.treks.se
Authentication
All API call must provide your application token in the Authorization header as well as the Content-Type header. In this documentation the example token 25b3c1fa37b9497590821b5e4465af70 is used.
Content-Type: application/json
Authorization: Token 25b3c1fa37b9497590821b5e4465af70Create new client
This call creates a new client database.
POST /api/v1/client HTTP/1.1
Content-Type: application/json
Authorization: Token 25b3c1fa37b9497590821b5e4465af70
{
"companyName": "Olles Mekaniska",
"companyTaxId": "112233-4455",
"firstName": "Olle",
"lastName": "Goop",
"employmentNumber": "1",
"userName": "olle@goop.se",
"password": ""
}Leave password blank to autogenerate a password. Username should be an email address. When the client database has been created a welcome email is automatically sent to this email address.
The response is a client token. This token is unique to the client and needs to be used when issuing subsequent calls.
{
"token": "f56a0d8648af456ba99cb045b232128b"
}Create a new user
This call creates a new user for a specific client.
POST /api/v1/user HTTP/1.1
Content-Type: application/json
Authorization: Token 25b3c1fa37b9497590821b5e4465af70
{
"client": "f56a0d8648af456ba99cb045b232128b",
"firstName": "Nils",
"lastName": "Nilsson",
"userName": "nils@example.com",
"employmentNumber": "2",
"password": "mysecretpassword"
}Expected response is HTTP Status Code 200 on success.
Delete a user
This call deletes a user for a specific client.
DELETE /api/v1/user HTTP/1.1
Content-Type: application/json
Authorization: Token 25b3c1fa37b9497590821b5e4465af70
{
"client": "f56a0d8648af456ba99cb045b232128b",
"userName": "nils@example.com"
}Expected response is HTTP Status Code 200 on success.
Get profit/loss for all projects
Retrieve a list of project with hours, billable amounts and costs.
Parameter 1: Client Id
Parameter 2: From date including
Parameter 3 To date including
GET /api/v1/customerprofitloss/9bbea5ef6e664aa78be65e9e9fbfab09/2018-01-01/2018-12-31 HTTP/1.1
Content-Type: application/json
Authorization: Token 25b3c1fa37b9497590821b5e4465af70Get profit/loss for all users
Retrieve a list of users with projects, hours, billable amounts and costs.
URL Parameter 1: Client Id
Query String parameters:
from: From date including
to: To date including
role (optional): Name of the user role
manager (optional): Id of the manager
GET /api/v1/9bbea5ef6e664aa78be65e9e9fbfab09/userprofitloss?from=2018-01-01&to=2018-12-31 HTTP/1.1
Content-Type: application/json
Authorization: Token 25b3c1fa37b9497590821b5e4465af70Last updated