Skip to main content
PUT
/
timmi-timesheet
/
services
/
time-entries
TimeEntries update service
curl --request PUT \
  --url https://{host}/timmi-timesheet/services/time-entries \
  --header 'Authorization: <authorization>' \
  --header 'Content-Type: application/json' \
  --data '
[
  {
    "owner": {
      "id": 123
    },
    "startsAt": "2024-05-06T00:00:00",
    "duration": {
      "iso": "PT4H"
    },
    "comment": null,
    "timeSource": "manual",
    "unit": "duration",
    "timeType": null,
    "axisSections": [
      {
        "id": 41
      },
      {
        "id": 127
      },
      {
        "id": 285
      },
      {
        "id": 319
      }
    ]
  },
  {
    "owner": {
      "id": 123
    },
    "startsAt": "2024-05-06T00:00:00",
    "duration": {
      "iso": "PT2H"
    },
    "comment": null,
    "timeSource": "manual",
    "unit": "duration",
    "timeType": null,
    "axisSections": [
      {
        "id": 41
      },
      {
        "id": 290
      },
      {
        "id": 309
      },
      {
        "id": 311
      }
    ]
  },
  {
    "owner": {
      "id": 123
    },
    "startsAt": "2024-05-07T00:00:00",
    "duration": {
      "iso": "PT7H20M"
    },
    "comment": "This is a comment",
    "timeSource": "manual",
    "unit": "duration",
    "timeType": null,
    "axisSections": [
      {
        "id": 41
      },
      {
        "id": 127
      },
      {
        "id": 285
      },
      {
        "id": 319
      }
    ]
  }
]
'
import requests

url = "https://{host}/timmi-timesheet/services/time-entries"

payload = [
{
"owner": { "id": 123 },
"startsAt": "2024-05-06T00:00:00",
"duration": { "iso": "PT4H" },
"comment": None,
"timeSource": "manual",
"unit": "duration",
"timeType": None,
"axisSections": [{ "id": 41 }, { "id": 127 }, { "id": 285 }, { "id": 319 }]
},
{
"owner": { "id": 123 },
"startsAt": "2024-05-06T00:00:00",
"duration": { "iso": "PT2H" },
"comment": None,
"timeSource": "manual",
"unit": "duration",
"timeType": None,
"axisSections": [{ "id": 41 }, { "id": 290 }, { "id": 309 }, { "id": 311 }]
},
{
"owner": { "id": 123 },
"startsAt": "2024-05-07T00:00:00",
"duration": { "iso": "PT7H20M" },
"comment": "This is a comment",
"timeSource": "manual",
"unit": "duration",
"timeType": None,
"axisSections": [{ "id": 41 }, { "id": 127 }, { "id": 285 }, { "id": 319 }]
}
]
headers = {
"Authorization": "<authorization>",
"Content-Type": "application/json"
}

response = requests.put(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'PUT',
headers: {Authorization: '<authorization>', 'Content-Type': 'application/json'},
body: JSON.stringify([
{
owner: {id: 123},
startsAt: '2024-05-06T00:00:00',
duration: {iso: 'PT4H'},
comment: null,
timeSource: 'manual',
unit: 'duration',
timeType: null,
axisSections: [{id: 41}, {id: 127}, {id: 285}, {id: 319}]
},
{
owner: {id: 123},
startsAt: '2024-05-06T00:00:00',
duration: {iso: 'PT2H'},
comment: null,
timeSource: 'manual',
unit: 'duration',
timeType: null,
axisSections: [{id: 41}, {id: 290}, {id: 309}, {id: 311}]
},
{
owner: {id: 123},
startsAt: '2024-05-07T00:00:00',
duration: {iso: 'PT7H20M'},
comment: 'This is a comment',
timeSource: 'manual',
unit: 'duration',
timeType: null,
axisSections: [{id: 41}, {id: 127}, {id: 285}, {id: 319}]
}
])
};

fetch('https://{host}/timmi-timesheet/services/time-entries', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://{host}/timmi-timesheet/services/time-entries",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
[
'owner' => [
'id' => 123
],
'startsAt' => '2024-05-06T00:00:00',
'duration' => [
'iso' => 'PT4H'
],
'comment' => null,
'timeSource' => 'manual',
'unit' => 'duration',
'timeType' => null,
'axisSections' => [
[
'id' => 41
],
[
'id' => 127
],
[
'id' => 285
],
[
'id' => 319
]
]
],
[
'owner' => [
'id' => 123
],
'startsAt' => '2024-05-06T00:00:00',
'duration' => [
'iso' => 'PT2H'
],
'comment' => null,
'timeSource' => 'manual',
'unit' => 'duration',
'timeType' => null,
'axisSections' => [
[
'id' => 41
],
[
'id' => 290
],
[
'id' => 309
],
[
'id' => 311
]
]
],
[
'owner' => [
'id' => 123
],
'startsAt' => '2024-05-07T00:00:00',
'duration' => [
'iso' => 'PT7H20M'
],
'comment' => 'This is a comment',
'timeSource' => 'manual',
'unit' => 'duration',
'timeType' => null,
'axisSections' => [
[
'id' => 41
],
[
'id' => 127
],
[
'id' => 285
],
[
'id' => 319
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>",
"Content-Type: application/json"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"strings"
"net/http"
"io"
)

func main() {

url := "https://{host}/timmi-timesheet/services/time-entries"

payload := strings.NewReader("[\n {\n \"owner\": {\n \"id\": 123\n },\n \"startsAt\": \"2024-05-06T00:00:00\",\n \"duration\": {\n \"iso\": \"PT4H\"\n },\n \"comment\": null,\n \"timeSource\": \"manual\",\n \"unit\": \"duration\",\n \"timeType\": null,\n \"axisSections\": [\n {\n \"id\": 41\n },\n {\n \"id\": 127\n },\n {\n \"id\": 285\n },\n {\n \"id\": 319\n }\n ]\n },\n {\n \"owner\": {\n \"id\": 123\n },\n \"startsAt\": \"2024-05-06T00:00:00\",\n \"duration\": {\n \"iso\": \"PT2H\"\n },\n \"comment\": null,\n \"timeSource\": \"manual\",\n \"unit\": \"duration\",\n \"timeType\": null,\n \"axisSections\": [\n {\n \"id\": 41\n },\n {\n \"id\": 290\n },\n {\n \"id\": 309\n },\n {\n \"id\": 311\n }\n ]\n },\n {\n \"owner\": {\n \"id\": 123\n },\n \"startsAt\": \"2024-05-07T00:00:00\",\n \"duration\": {\n \"iso\": \"PT7H20M\"\n },\n \"comment\": \"This is a comment\",\n \"timeSource\": \"manual\",\n \"unit\": \"duration\",\n \"timeType\": null,\n \"axisSections\": [\n {\n \"id\": 41\n },\n {\n \"id\": 127\n },\n {\n \"id\": 285\n },\n {\n \"id\": 319\n }\n ]\n }\n]")

req, _ := http.NewRequest("PUT", url, payload)

req.Header.Add("Authorization", "<authorization>")
req.Header.Add("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.put("https://{host}/timmi-timesheet/services/time-entries")
.header("Authorization", "<authorization>")
.header("Content-Type", "application/json")
.body("[\n {\n \"owner\": {\n \"id\": 123\n },\n \"startsAt\": \"2024-05-06T00:00:00\",\n \"duration\": {\n \"iso\": \"PT4H\"\n },\n \"comment\": null,\n \"timeSource\": \"manual\",\n \"unit\": \"duration\",\n \"timeType\": null,\n \"axisSections\": [\n {\n \"id\": 41\n },\n {\n \"id\": 127\n },\n {\n \"id\": 285\n },\n {\n \"id\": 319\n }\n ]\n },\n {\n \"owner\": {\n \"id\": 123\n },\n \"startsAt\": \"2024-05-06T00:00:00\",\n \"duration\": {\n \"iso\": \"PT2H\"\n },\n \"comment\": null,\n \"timeSource\": \"manual\",\n \"unit\": \"duration\",\n \"timeType\": null,\n \"axisSections\": [\n {\n \"id\": 41\n },\n {\n \"id\": 290\n },\n {\n \"id\": 309\n },\n {\n \"id\": 311\n }\n ]\n },\n {\n \"owner\": {\n \"id\": 123\n },\n \"startsAt\": \"2024-05-07T00:00:00\",\n \"duration\": {\n \"iso\": \"PT7H20M\"\n },\n \"comment\": \"This is a comment\",\n \"timeSource\": \"manual\",\n \"unit\": \"duration\",\n \"timeType\": null,\n \"axisSections\": [\n {\n \"id\": 41\n },\n {\n \"id\": 127\n },\n {\n \"id\": 285\n },\n {\n \"id\": 319\n }\n ]\n }\n]")
.asString();
require 'uri'
require 'net/http'

url = URI("https://{host}/timmi-timesheet/services/time-entries")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Put.new(url)
request["Authorization"] = '<authorization>'
request["Content-Type"] = 'application/json'
request.body = "[\n {\n \"owner\": {\n \"id\": 123\n },\n \"startsAt\": \"2024-05-06T00:00:00\",\n \"duration\": {\n \"iso\": \"PT4H\"\n },\n \"comment\": null,\n \"timeSource\": \"manual\",\n \"unit\": \"duration\",\n \"timeType\": null,\n \"axisSections\": [\n {\n \"id\": 41\n },\n {\n \"id\": 127\n },\n {\n \"id\": 285\n },\n {\n \"id\": 319\n }\n ]\n },\n {\n \"owner\": {\n \"id\": 123\n },\n \"startsAt\": \"2024-05-06T00:00:00\",\n \"duration\": {\n \"iso\": \"PT2H\"\n },\n \"comment\": null,\n \"timeSource\": \"manual\",\n \"unit\": \"duration\",\n \"timeType\": null,\n \"axisSections\": [\n {\n \"id\": 41\n },\n {\n \"id\": 290\n },\n {\n \"id\": 309\n },\n {\n \"id\": 311\n }\n ]\n },\n {\n \"owner\": {\n \"id\": 123\n },\n \"startsAt\": \"2024-05-07T00:00:00\",\n \"duration\": {\n \"iso\": \"PT7H20M\"\n },\n \"comment\": \"This is a comment\",\n \"timeSource\": \"manual\",\n \"unit\": \"duration\",\n \"timeType\": null,\n \"axisSections\": [\n {\n \"id\": 41\n },\n {\n \"id\": 127\n },\n {\n \"id\": 285\n },\n {\n \"id\": 319\n }\n ]\n }\n]"

response = http.request(request)
puts response.read_body
{
  "title": "One or more validation errors occurred.",
  "status": 400,
  "errors": {
    "$[0]": [
      "You cannot create a time entry that spans over two days."
    ],
    "$[0].AxisSections": [
      "AxisSections must all be active and consistent with the tree structure of their sections"
    ],
    "$[2]": [
      "You cannot create a time entry with a duration that exceeds 24h."
    ]
  }
}

Headers

Authorization
string
required

API key. Value must be formatted like so: lucca application={api_key}.

Query Parameters

startsOn
string<date>
required

First day (included) of the period you want to update with provided TimeEntries.

Pattern: yyyy-MM-dd
endsOn
string<date>
required

Last day (included) of the period you want to update with provided TimeEntries.

Pattern: yyyy-MM-dd
ownerId
integer
required

Unique identifier of the TimeEntries owner.

Body

application/json
owner
object
required
startsAt
string<date-time>
required

The timeEntry start date and time. Please do NOT send any offset/timezone information ("Z", "+01:00", etc...).

Example:

"2023-10-12T12:00:00"

unit
enum<string>
required

Unit in which the TimeEntry has been entered.

  • day: share a of a 24-hour day (e.g. "1/2 day")
  • duration: number of hours (e.g. "8h15min")
  • time: accurate time of a day (e.g. "23:45:00")
Available options:
day,
duration,
time
duration
object
required
axisSections
object[] | null

The activities this TimeEntry should be associated with. When not in activity mode, send an empty array, or do not serialize this property.

timeType
object | null

Optional reference of a configured Time Type. To use only if the timesheet is set up to use Time Types. Null otherwise.

timeSource
enum<string>
default:manual

Attribute used to identify last modification source :

  • manual : Manually created or edited (default).
  • import : Imported from external sources. Is read-only on Lucca Timesheet user interfaces only if Timesheet regulation is in following modes : attendance schedule with clock-in clock-out, and activity-schedule
  • timer : Entered with Lucca Timesheet clock-in clock-out tool.
Available options:
manual,
import,
timer
comment
string | null

A comment on the TimeEntry, visible on Lucca Timesheet user interface.

Response

OK