POST /times

Request parameters

ParameterTypeDescription
userIdstringIf provided time entry will be saved for this user. If not provided a time entry will be created for the user who is authenticated and who is making the API call.
idstringIf provided time entry will be edited. If not provided a new time entry will be created.
fromdateTime entry start date and time in ISO-8601 format containing a timezone, eg. 2022-04-25T08:00:00+03:00
todateTime entry end date and time in ISO-8601 format containing a timezone, eg. 2022-04-25T18:30:00+03:00
breaksarray [object]If provided one or multiple breaks will be created.
from (breaks)dateBreak start date and time in ISO-8601 format containing a timezone, eg. 2022-04-25T10:40:00+03:00
to (breaks)dateBreak end date and time in ISO-8601 format containing a timezone, eg. 2022-04-25T11:20:00+03:00
timeTypestringMandatory input from on of these: "work", "parental_leave", "worked_rest_period", "clocking", "statutory_leave", "public_holiday_abroad", "medical_leave", "bad_weather", "company_vacation", "unpaid_vacation", "care_leave", "out_office", "work_accident_sickness", "military_exercize", "flextime", "unpaid_time_off", "home_office", "study_leave", "paid_time_off", "other_leave", "vacation_abroad", "travel", "sick", "military_service", "jubilee_day", "vacation", "move", "special_leave", "free_time"
commentstringIf provided a comment will be created.
organizationobjectProvide "name" or "id" to which the time entry belongs. If you provide both then "name" will be ignored.
name (organization)stringProvide name of organization to which the time entry belongs. If two or more organizations have the same name a random of these organizations will be chosen.
id (organization)stringProvide id of organization. Contrary to the name the id of the organization is unique and should be a preferred use.

Request JSON example:

{
    "userId": "123456fb-ae4a-422e-9e90-5ecdbb1af123",
    "times": [
        {
            "id": "987ea1fb-ae4a-422e-9e90-5ecdbb1afb7f", 
            "from": "2022-04-25T08:00:00+03:00",
            "to": "2022-04-25T18:30:00+03:00",
            "breaks": [
                {
                    "from": "2022-04-25T10:40:00+03:00",
                    "to": "2022-04-25T11:20:00+03:00"
                }, //add multiple breaks if desired
                {
                    "from": "2022-04-25T12:40:00+03:00",
                    "to": "2022-04-25T13:20:00+03:00"
                }
            ],
            "timeType": "work",
            "comment": "Test Kommentar",
            "organization": {
                "name": "Name of organization" OR "id": "xxxxxxxxxxxxxx"
            }
        }
    ]
}

📘

Send multiple time entries in one request

You can send up to 30 time entries for one user in one request by extending the times array. If you do so make sure that "organization" is same for every time entry, otherwise you will get back an error.

🚧

Overwriting time entries

If a time entry overlap with an existing time entry, then new time entry will be created and existing one will be removed. In case that the existing time entry is already "approved", then you will get back an error that new time entry could not be saved.

🚧

Warning

If times "id" is sent in request, then existing time entry will be edited.
If in such a case the request JSON has NULL values (because some attributes are not sent at all), then all objects with NULL values will be removed.

When updating a time entry, then make sure that already saved data is sent in request again in order to avoid deleting this data.

Responses

CodeTitleDescription
200 SuccessReturned if request was successful.
201SuccessReturned if request was successful but time entry was overwritten or trimmed or otherwise edited.
400Bad RequestReturned if request was bad.
401UnauthorizedReturned if request was not authorized (eg. due to bad API key).
404Not FoundReturned if request could not be found.

Response JSON example:

{
    "items": [
        {
            "message": "Report is stored", 
            "data": {
                "id": "85561232-4ca4-4a0e-80d8-844be70aa0b3",
                "from": "2022-04-22T10:40:00+03:00",
                "to": "2022-04-22T18:40:00+03:00",
                "breaks": [
                    {
                        "id": "59876501-5c90-467e-a4d4-b86ad14a5dcb", 
                        "from": "2022-04-22T10:40:00+03:00", 
                        "to": "2022-04-22T18:40:00+03:00",
                        "automatic": false //true or false if autmatic breaks were saved through target times.
                    }
                ],
                "comment": "Test Comment",
                "type": "work",
                "organizationName": "Project ABC",
                "userName": "John Doe",
                "userId": "12341232-4ca4-4a0e-80d8-844be70aa0b3",
                "category": "productive", //category of timeType, possible responses "productive", "unproductive", "vacation", "sick", "paid_leave", "unpaid_leave"
                "creationType": "times" //possible responses "times", "clock", "wtm"  or "null". "times" will be returned if time entry was saved manually with from-to times. "clock" will be returned if time entry was clocked. "wtm" will be returned if time entry was saved automatically via the working time model. "null" will be returned if time entry was edited.
            }
        }
    ],
    "valid": true //true if successful, false if not
}