Michael Krupsdahl
Michael Krupsdahl

Reputation: 1

Clockify Integration (extract time entries for a given period)

I am in the process of building an integration between Clockify and Zoho CRM. Where I have clients and projects and staff defined in Zoho.

All the clients and projects are synchronised fine from Zoho to Clockify. But now I have reached a snag with the method of fetching time entries for all users in a given period. Time registered in Clockify needs to be transferred to Zoho, so we can bill the client and register the hours for the staff for the salary run, all done in Zoho CRM.

At first I looked at the /workspaces/{workspaceid}/timeEntries/ But that does not provide a range period, Also the limits parameter described in the api documentation, does not change the number of items returned from the default 10 items.

Then I looked at both /workspaces/{workspaceid}/timeEntries/{userid} /workspaces/{workspaceid}/timeEntries/{userid}/entriesInRange One provides a range, but both only gives access to the user with the apikey, even though that’s the owner of the workspace.

How do I get a list of all timeEntries all the users has registered in the workspace for a given period. The information should include project and task if defined on the record. Perhaps I have overlooked something in the api document.

Br Michael

Upvotes: 0

Views: 1007

Answers (4)

Stephen Read
Stephen Read

Reputation: 26

I was having issues today with the exact same calls to the POST /workspaces/{workspaceId}/reports/summary/ that were working Monday. I ended up figuring out the issue was the "me" field, which seems to either no longer exist on the server or is no longer a boolean, as I get a "No enum constant com.clockify.domain.model.DashboardSelection.false" error (code 3002)". Try removing the "me" field from your JSON, and as you mentioned, the string array fields should not have the "" around the []. Your data should look something like this:

{ "startDate": "2018-10-01T00:00:00.000Z", "endDate": "2018-10-301T23:59:59.999Z", "userGroupIds": [], "userIds": [], "projectIds": [], "clientIds": [], "taskIds": [], "tagIds": [], "billable": "BOTH", "includeTimeEntries": "true", "zoomLevel": "week", "description": "", "archived": "Active", "roundingOn": "false" }

Upvotes: 0

Michael Krupsdahl
Michael Krupsdahl

Reputation: 1

Found out the documentation has incorrectly "" around the [] arrays for groups of ids. Removing these resolved it.

Upvotes: 0

Michael Krupsdahl
Michael Krupsdahl

Reputation: 1

Thanks, calling the report/summary url, I get a 405 Not Allowed. when sending the following json body in a post method.

{ "startDate": "2018-10-01T00:00:00.000Z", "endDate": "2018-10-301T23:59:59.999Z", "me": "false", "userGroupIds": "[]", "userIds": "[]", "projectIds": "[]", "clientIds": "[]", "taskIds": "[]", "tagIds": "[]", "billable": "BOTH", "includeTimeEntries": "true", "zoomLevel": "week", "description": "", "archived": "Active", "roundingOn": "false" }

Result.

<html>
    <head>
        <title>405 Not Allowed</title>
    </head>
    <body bgcolor="white">
        <center>
            <h1>405 Not Allowed</h1>
        </center>
        <hr>
        <center>nginx/1.6.2</center>
    </body>
</html>

I know my API key is correct, because I can call https://api.clockify.me/api/workspaces/{workspaceid}/userGroups just fine returning a list of the usergroups in my workspace.

br Michael

Upvotes: 0

user2551768
user2551768

Reputation: 488

Summary Report API would be suitable for your use case. See /workspaces/{workspaceId}/reports/summary/

It will give you time entries in requested range, and you can toggle between your and your team's entries with request parameter 'me'.

Upvotes: 1

Related Questions