skip to content

API - Get Supplier History

URL: getSupplierHistory_JSON.php

Required Fields:

username
password
SupplierID (the supplier_id unique to this business, not globally)

Optional Fields:

StartDate - format YYYY-MM-DD (if specified, only transactions from this date (included) will be returned)
EndDate - format YYYY-MM-DD (if specified, only transactions to this date (included) will be returned
Order - ASC or DESC (default)

Returns:

JSON encoded array of supplier transaction history in the following format:

//Purchase Orders
$array[supplier_id][doc_type][doc_number][total] = total; //total of the document
$array[supplier_id][doc_type][doc_number]= link; //link to generate the document, no login required
$array[supplier_id][doc_type][doc_number][details][i][doc_field_item_name] = doc_field_item_value;//General
$array[supplier_id][balance] = balance;
$array[supplier_id][opening_balance] = opening_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/getSupplierHistory_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