skip to content

API - Get Supplier History

URL: getSupplierHistory_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
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 with JSON

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

$url = 'https://www.jobcardsonline.co.za/api/getSupplierHistory_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