Release 0.4 of PHP Wrapper Library for Harvest API

Release 0.4 is now available of the Harvest API PHP Wrapper Library. This update to the library supports both the Time Tracking and Extended REST APIs, in addition to bug fixes and additional documentation. To stay up-to-date with all the changes visit the main library page available here.

// Harvest // PHP //

Comments & Questions

  1. Hi Matthew,
    you were right the fix solved my problem, now i’m able to connect and retrieve some data.

    Now a new problem, the call getUserExpenses works well but changing to getUserEntries i receive no data (result->isSuccess() true but no data in the returning arrray)

    The code is the same, i have changed only the call from the first function to the second and again using RESTTest works well for both functions.

    Any idea? Thank you for your support!!

    1. Hi, sorry about the problems, I didn’t retest the extended api after I went through with the time tracking api. As it turns out day-entry is used in both apis and in the time tracking it is day_entry and in the extended api it is day-entry. Version 0.4.2 will resolve this issue and you can download it here

  2. Sorry to bother you, but i’m not able to use your library in the correct way!

    My code:
    $api = new HarvestAPI();
    $api->setUser( “myusername” );
    $api->setPassword( “mypassword8qmsi” );
    $api->setAccount( “mysubdomain” );
    $api->setSSL(true);
    $result = $api->getProjects();

    but $resukt->isSuccess() is always false!!

    Am i missing something?

    Copying and pasting the querystring with the plugin RestTest shows the correct data, so i suppose it is not a problem of authentication

    1. Hi, you are doing nothing wrong, as it turns out the underlying cURL library is trying to authenticate the SSL certificate. I have deactivated SSL certificate verification and released Version 0.4.1 containing the fix, this should resolve the issue you are facing.

  3. Hi Matthew,
    thank you for your library!

    I got a question for you, i am using Harvest and the only caveat is the missing month view of time and expenses.

    Do you think that using your library i can easily create a month view only to see in a single screenshot all the hours inserted by one person?

    Thank you

    1. Hi, I’m glad you find the library useful. The Harvest API has a reporting interface that will give you the report you need. The appropriate two methods in the library you are looking for are getUserEntriesand getUserExpenses.

      getUserEntries will return all time entries for an individual for a given date range. The Harvest_Range object is currently used for setting the date range and the expected format is YYYYMMDD.

      $range = new Harvest_Range( "20090701", "20090730" );
      $user_id = 11111;
      
      $api = new HarvestAPI();
      //set Harvest Account information
      
      $result = $api->getUserEntries( $user_id, $range );
      if( $result->isSuccess() ) {
          $timeEntries= $result->data;
      }
      

      Similarly you can use the getUserExpenses method to get a users expenses, it takes the same parameters as the time entry query above.

Add Your Comment

Leave a Reply to Bitconscious Cancel