lumbric
lumbric

Reputation: 9093

How to specify date/time for the clockify API? Which fields are optional?

This seems to work fine:

curl -H 'content-type':'application/json' -H 'X-Api-Key':'<my-key>' -X POST --data '{"start": "2018-06-12T13:48:14.000Z", "tagIds": ["<my-tag-id>"] }' https://api.clockify.me/api/workspaces/<my-workspace-id>/timeEntries/

It creates a new entry without end date (clock still running) beginning with given time stamp. "start" seems to be a required field. If I omit the "start" field I get an error:

{"message":"text","code":3002}%                                                                                                       

I am wondering if it is possible to start the clock now without absolute time stamp, i.e. by doing something like:

curl -H 'content-type':'application/json' -H 'X-Api-Key':'<my-key>' -X POST --data '{"start": "now", "tagIds": ["<my-tag-id>"] }' https://api.clockify.me/api/workspaces/<my-workspace-id>/timeEntries/

Unfortunately "now" does not work:

{"message":"Could not read document: Can not construct instance of com.clockify.adapter.http.timeentry.CreateTimeEntryRequest, problem: Text '' could not be parsed at index 0\n at [Source: java.io.PushbackInputStream@1817b774; line: 1, column: 54]; nested exception is com.fasterxml.jackson.databind.JsonMappingException: Can not construct instance of com.clockify.adapter.http.timeentry.CreateTimeEntryRequest, problem: Text '' could not be parsed at index 0\n at [Source: java.io.PushbackInputStream@1817b774; line: 1, column: 54]","code":3002}%  

Upvotes: 0

Views: 705

Answers (1)

user2551768
user2551768

Reputation: 488

Right now 'start' is the only mandatory field on that endpoint, and there is no workaround to automatically start with current time. We'll certainly take this feedback into consideration for future improvements of the API.

Upvotes: 1

Related Questions