PHP Wrapper Library for the Harvest API
Harvest users can use the Harvest API to query and utilize information from their Harvest account in their own applications. Currently there is an open-sourced Harvest Ruby wrapper that can be obtained from github. But as I prefer to utilize PHP, I have created the Harvest api PHP interface (HaPi) library. This Open Source library is licensed under the GNU General Public License v3 license.
The current version of the library is 1.1.0. This release contains support for the full Time Tracking and Extended Rest APIs and requires the user to have cURL support. In addition this version of the library contains the HarvestReports object which can be used to perform additional queries like getActiveProjects and getActiveTimers. Please visit the downloads page to download the latest version of the library.
Line 1323 / 1324:
$url = “expesnses/$expense->id”;
return $this->performPUT( $url, $obj->toXML() );
should be:
$url = “expenses/$expense->id”;
return $this->performPUT( $url, $expense->toXML() );
Hi Turaj:
Thanks for reporting the typo. It looks like the current version on GitHub has the fix implimented. https://github.com/mdbitz/HaPi
Hi, are you looking at publishing this library on GitHub so others can contribute to it? Thanks
Great API. Thanks.
There is a typo on line 2264
$inovice_id should be $invoice_id
how i set session in harvest api php
I have written as
Please help me how to get other contact details of the client like email, mobile no’s, office…etc in Harvest API in php?
Hi, Harvest unfortunately doesn’t store contact information at the Client level. Within Harvest they have a single “Address” field that gets returned in the details property of the Client object. If you wanted to you can add the client’s phone numbers and email into this section however you would need to then parse the text for separating the information.
For example you could specify a token at the beginning of each line (phone) xxx-xxx-xxxx (email) xxx@xxxxx.xxx and do a read of each line to get the individual values returned.
Also you should switch your if success and foreach statement around as follows
We have some additions to the code that we would like to submit. How do we send our updates?
Very nice tools, thank you!
I just noticed it does not support the “of_user” parameter for createEntry() function / api call.
Andreas:
I haven’t made updates to the HaPi library in some time. I should have some free time in the next couple of weeks to review and I’ll sync it with the current Harvest functionality.
Found a bug. HarvestAPI.php line 1524:
$url = “projects/” . $userAssignment->get(“project-id”) . “/user_assignments/” . $userAssignment->get(“user-id”);
should be:
$url = “projects/” . $userAssignment->get(“project-id”) . “/user_assignments/” . $userAssignment->get(“id”);