Time entries update issue

Trying set tag for specified time entry, but it’s look like i’m trying insert new one…
That i do wrong?

curl --location --request PUT 'https://api.clockify.me/api/v1/workspaces/.../time-entries/6626e06338907a5b7adb4445' \
--header 'Content-Type: application/json' \
--header 'X-Api-Key: ...' \
--data '{
    "start": "2024-04-22T22:26:12Z",
    "tagIds": [
        "6625bbbec2a4fb3be97372c5"
    ]
}'
{
    "message": "Duplicate unique key error",
    "code": 501
}

Hi Actimele,

When making the request to edit a time entry with the intent of adding a tag, all parameters of the existing time entry would have to be specified in the body, along with including a new tag to the entry.
When the call to update a time entry is used, and a parameter from the existing entry is left out, it will update the time entry by removing that specific parameter.

The body should include the “start” and “end” parameters, as well as any other parameters that are on the time entry you are trying to update. This might include “projectId”, and other parameters on the entry.

Cheers!

1 Like