skip to content

API - Get All Suppliers

URL: getSuppliers_JSON.php

Required Fields:

username
password

Returns:

JSON encoded array of all Suppliers in the following format:
$array[supplier_id][field_name] = field_value;

Fields Returned:

supplier_id: ID of the Supplier - unique to this business, but not globally unique (when using this Supplier id, the business id is always also required)
supplier_name
supplier_account_number
supplier_vat_nr
supplier_phone_nr
supplier_phone_nr2
supplier_fax_nr
supplier_mobile_nr
supplier_email
contact_name
contact_surname
supplier_postal_address1
supplier_postal_address2
supplier_postal_address3
supplier_postal_address4
supplier_physical_address1
supplier_physical_address2
supplier_physical_address3
supplier_physical_address4
supplier_notes - max 10,000 characters - Notes on the Supplier (should not be made visible to the Supplier)
active - 1 or 0
balance - decimal(20,2) - current balance of the Supplier
opening_balance - decimal(20,2) - initial balance of the Supplier, should always be deducted from the current balance, in order to obtain the true current balance

Example PHP code

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

foreach ($param as $key => $val) {
 $request.= $key . '=' . urlencode($val);
  $request.= '&';
}
$request = substr($request, 0, -1); //remove trailing &

$url = 'https://www.invoicesonline.co.za/api/getSuppliers_JSON.php';
$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, $request); //set the POST variables
$response = curl_exec($ch); //run the whole process and return the response

 

Updated: Tue, 16 August 2016