Implementation Examples - mdbitz/HaPi GitHub Wiki
Implementation examples
The following will help you along with implementation:
Clients
Get a client:
$client_id = 11111;
$api = new HarvestAPI();
$result = $api->getClient($client_id);
if ($result->isSuccess())
{
$client = $result->data;
}
Get client contacts:
$client_id = 11111;
$api = new HarvestAPI();
$result = $api->getClientContacts($client_id);
if ($result->isSuccess())
{
$client_contacts = $result->data;
}
Invoices
Get all client invoices:
$client_id = 11111;
$api = new HarvestAPI();
$filter = new Harvest_Invoice_Filter();
$filter->set("status", Harvest_Invoice_Filter::UNPAID);
$filter->set("client", $client_id);
$result = $api->getInvoices($filter);
if ($result->isSuccess())
{
$client_invoices = $result->data;
}