Skip to content

peppeocchi/zoho-books

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 

Repository files navigation

Zoho Books API

IMPORTANT This doesn't support the latest version of ZOHO api

Zoho Books API requests limit

At the time of writing, the API requests limit is 150 requests per minute per organization

Init

$zb = new ZohoBooks('your authentication token', 'your organization id');

The above code will set the API start time

How to get authtoken and organizationId?

Please refer to the official Zoho Books Documentation https://www.zoho.com/books/api/v3/

==========

Contacts

Get all contacts

$contacts = $zb->allContacts();

Get contact by ID

$contact = $zb->getContact(contact_id);

These functions will return a json string if success, false in case of failure

==========

Invoices

Get all invoices

$invoices = $zb->allInvoices();

You can also set a data range

$invoices = $zb->allInvoices('2014-10-07', '2014-10-08');

Get invoice by ID

$invoice = $zb->getInvoice(invoice_id);

These functions will return a json string if success, false in case of failure

Create an invoice

$zb->postInvoice('invoice_json', true);

This function will return true if success, false in case of failure The second parameter is optional, the default value is false, if set to true will send the invoice to the customer

==========

Credit notes

Get all credit notes

$creditNotes = $zb->allCreditNotes();

You can also set a data range

$creditNotes = $zb->allCreditNotes('2014-10-07', '2014-10-08');

Get credit note by ID

$creditNote = $zb->getCreditNote(creditNote_id);

These functions will return a json string if success, false in case of failure

Create a credit note

$zb->postCreditNote('creditNote_json');

This function will return true if success, false in case of failure

==========

Response HTTP Code

$httpCode = $zb->getHttpCode();

This function will return the response HTTP code after an API call.

==========

API requests limit

After each call to one of the methods above, a private method check that we haven't reached the Zoho Books limit. If we've sent 150 requests, the script is sleeped until the end of the minute from the first request.