It is recommended to rather obtain all suppliers, and parse the information for a specific supplier, but this function is available if you do require it.
to use as JSON, append ?apiformat=json to the URL, then send through all variables as a JSON encoded string.
SupplierID (the supplier_id unique to this business, not globally)
JSON encoded array of supplier information in the following format:
$array[supplier_id][field_name] = field_value;
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_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
$param['username'] = ''; $param['password'] = ''; $param['SupplierID'] = ''; //note the case $url = 'https://www.invoicesonline.co.za/api/getSupplierDetails_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