skip to content

API - Get Client Documents by Type

URL: getDocumentsByType_JSON.php

JSON Option (recommended):

to use as JSON, append ?apiformat=json to the URL, then send through all variables as a JSON encoded string.

Required Fields:

username
password
ClientID (the client_id unique to this business, not globally)
type - valid options are: 'credit_notes,delivery_notes,invoices,jobcards,pro-forma_invoices,quotes,recurring_invoices,recurring_pro-forma_invoices

Returns:

JSON encoded array of client documents in the following format:

$array[client_id][doc_id][field_name] = field value;

Example PHP code with JSON

$param['username'] = '';
$param['password'] = '';
$param['ClientID'] = '';
$param['type'] = '';

$url = 'https://www.invoicesonline.co.za/api/getDocumentsByType_JSON.php?apiformat=json';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url); //set the url
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); //return as a variable
curl_setopt($ch, CURLOPT_POST, 1); //set POST method
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($param)); //set the POST variables
$response = curl_exec($ch); //run the whole process and return the response

 

Updated: Sat, 30 May 2020