URL: NewSupplier.php
to use as JSON, append ?apiformat=json to the URL, then send through all variables as a JSON encoded string.
username
password
supplier_name (255 characters max)
supplier_email (255 characters max)
supplier_account_number (255 characters max)
supplier_vat_nr (255 characters max)
supplier_phone_nr (20 characters max)
supplier_phone_nr2 (20 characters max)
supplier_fax_nr (20 characters max)
supplier_mobile_nr (20 characters max)
contact_name (255 characters max)
contact_surname (255 characters max)
supplier_postal_address1 (255 characters max)
supplier_postal_address2 (255 characters max)
supplier_postal_address3 (255 characters max)
supplier_postal_address4 (255 characters max)
supplier_physical_address1 (255 characters max)
supplier_physical_address2 (255 characters max)
supplier_physical_address3 (255 characters max)
supplier_physical_address4 (255 characters max)
Integer
; //only an integer will be returned, which is either the new supplier_id or an existing supplier_id if the Supplier already exists.
If anything else is returned, an error occurred and the error is returned as a string.
$param['username'] = '';
$param['password'] = '';
$param['supplier_name'] = '';
$param['supplier_phone_nr'] = '';
$param['supplier_phone_nr2'] = '';
$param['supplier_mobile_nr'] = '';
$param['supplier_email'] = '';
$param['supplier_vat_nr'] = '';
$param['supplier_fax_nr'] = '';
$param['contact_name'] = '';
$param['contact_surname'] = '';
$param['supplier_postal_address1'] = '';
$param['supplier_postal_address2'] = '';
$param['supplier_postal_address3'] = '';
$param['supplier_postal_address4'] = '';
$param['supplier_physical_address1'] = '';
$param['supplier_physical_address2'] = '';
$param['supplier_physical_address3'] = '';
$param['supplier_physical_address4'] = '';
$url = 'https://www.jobcardsonline.co.za/api/NewSupplier.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