URL: getClientHistory_JSON.php
to use as JSON, append ?apiformat=json to the URL, then send through all variables as a JSON encoded string.
username
password
ClientID (the client_id unique to this business, not globally)
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)
JSON encoded array of client transaction history in the following format:
//Invoices, Credit Notes, Pro Forma Invoices, Payouts, Payments
$array[client_id][doc_type][doc_number][total] = total; //total of the document
$array[client_id][doc_type][doc_number]= link; //link to generate the document, no login required
$array[client_id][doc_type][doc_number][details][i][doc_field_item_name] = doc_field_item_value;//General
$array[client_id][balance] = balance;
$array[client_id][opening_balance] = opening_balance;
$param['username'] = '';
$param['password'] = '';
$param['ClientID'] = '';
$url = 'https://www.jobcardsonline.co.za/api/getClientHistory_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