Added by Eric Fischer 21 days ago
I am trying to import time_entries from a third party system to OpenProject.
The request body:
{
"comment": "Logging time",
"startTime": "2025-10-13T14:45:00.000Z",
"endTime": "2025-10-13T16:00:00.000Z",
"_links": {
"project": { "href": "/api/v3/projects/3" },
"entity": { "href": "/api/v3/projects/3/work_packages/56" },
"user": { "href": "/api/v3/users/194" }
},
"spentOn": "2025-10-13",
"createdAt": "2025-12-12T19:20:28.059Z",
"updatedAt": "2025-12-12T19:20:28.059Z"
}
I think I followed the docs here: https://www.openproject.org/docs/api/endpoints/time-entries/
But I am only getting a non helping error:
{
"_type": "Error",
"errorIdentifier": "urn:openproject-org:api:v3:errors:InternalServerError",
"message": "An internal error has occurred.undefined method 'end_time=' for an instance of #<Class:0x00007f7c59e199c0>"
}
Does somebody have an explanation what is wrong?
Thanks in advance.
Replies (3)
Made some progress. Do not set the
endTimebut setstartTimeandhours.Also, do not set
createdAtandupdatedAtsince they are read only.However, now I am getting
{ "_type": "Error", "errorIdentifier": "urn:openproject-org:api:v3:errors:PropertyConstraintViolation", "message": "Logged for can't be blank.", "_embedded": { "details": { "attribute": "entity" } } }and I am stuck again...
Hello Eric,
logged time always needs to be connected to a user account. I presume that's why you received the
"Logged for can't be blank."error message.It is possible to log time for other users, however, you need to state for which user you are logging time. Each time entry is bound to a user.
Best
Alexander
Sorry for not responding with the solution, fixed it. Exactly as the error message stated, the work package link href was wrong (sorry for the sarcasm, will open a Feature request to improve the error handling). I used
/api/v3/projects/3/work_packages/56but you have to use/api/v3/work_packages/56.