0

Harvest Time tracking data for week & API v2

I want to load the time tracked per employee from Harvest data source.
I can see that only API v1 is currently working but it will be deprecated in future. Could not run any API v2 get calls via klipfolio

Query to pull today's daily time entries
https://account.harvestapp.com/daily.json?slim=1 

Also API v2 does not seem to work at all.
Sample query : https://api.harvestapp.com/v2/time_entries 

But how do we get data for entire week or any other time period here? Which dynamic source do we use from this Klipfolio created list - tried multiple but could not get them to work for Harvest particularly and there is no documentation either.

Lastly, How do I run API v2 queries here?

 

5 comments

  • 0
    Avatar
    Adam Doogan-Smith

    [Updated Image Example: August 31, 2021]

     

    Hi Torrey,

    It appears that the authentication process for v2 is different than v1. Since our connector uses the v1 format for authentication, you will need to use the REST/URL connector to perform any API call with v2. According to their documentation, there are three authorization headers that need to be passed with each API call. These include the access token, account id and user agent e-mail.

    Below is an example of what a v2 API call for time entries endpoint.

    https://api.harvestapp.com/v2/time_entries?from={date.add(-7).format()}&to={date.today}&page={props.page}

    Note that the parameters to and from are being used to define the date range with date parameters. This query is filtering to return data for the past 7 days.

    Since the max amount of records Harvest allows per page is 100, the page parameter is needed for pagination for the data source. Here is a handy document that details the steps required to set this up.





    If you do have any issues with this, please submit a support ticket to support@klipfolio.com and we'll be happy to help you further.

    Happy Dashboarding!

    Adam

  • 0
    Avatar
    Torrey Tayenaka

    Thanks Adam, this has been very helpful. 

    I could not get it to work despite several attempts at it and some other tech issues. 

    Any idea what email or app name we have to write under "User-Agent" - that seems to be ambiguous?

  • 0
    Avatar
    Adam Doogan-Smith

    Hi Torrey,

    If you are having issues, try replacing the {props.page} with a 1. It could be that you haven't created/set a default value for the page variable. By hard-coding a page value, this should result in a successful API call if this was the issue.

    For the user-agent value to insert, I assume this would be the e-mail that you use to authenticate with v1.

    -Adam

  • 0
    Avatar
    Ivan Jankovic LB

    Hi Adam, 

    The time entries will blow past 2000 rows if you have any amount of staff using the service.  How would you deal with that?  Also, as you noted above, the API has pagination, what is the best approach to deal with this?

    Ivan

  • 0
    Avatar
    Adam Doogan-Smith

    Hi Ivan,

    Yes since Harvest only allows a maximum of 100 records you'll most likely need to get creative on how to avoid having your queries run out. Usually we start to hit time-out issues when we approach 20 pages. 

    If you believe you have much more than 2000 records for a predefined date range, Harvest offers numerous parameters in which you can filter your time entries. These include, user_id, client_id, project_id, is_billed, is_running, updated_since, from, and to. This means you can create subsets of data by creating a specific data source for each use with a query like this:

    https://api.harvestapp.com/v2/time_entries?from={date.add(-30).format()}&to={date.today}&page={props.page}&user_id=xxxxxx

    This would return all time entry sheets in the past 30 days for a specific user. Likewise you could use a similar query but with &client_id=xxxxxx at the end of the query to return only time sheets pertaining to a particular client. 

    Hope this helps!

    Adam

Please sign in to leave a comment.