/bookkeeping/getCustomerByName.php

This method is used retreive a list of customers that have an exact name.
Do note that in most situations you only have one customer using the same name - but there is no constraint on the field so there might i.e. multiple customers run by the same person and hence using the same name.

Parameters

string name
The customer name of the customer(s) you are looking to find.
int companyId
The company id of the Uhasibu account required
string login
The login for the API user, logins are typically emails
string password
The password for the API user

Return values

int RESULT_AMOUNT
Contains the amount of result rows in the result set
array RESULT
Array containing the individual result rows
int RESULT : NUMBER
The customer number of the particular customer.
int RESULT : GROUP_ID
The id of the customer group that the particular customer is in.
int RESULT : CURRENCY_ID
The id of the currency that this customer operates in, this determines what currency the customer is going to be invoiced in.
int RESULT : PAYMENT_TERM_ID
The id of the payment term that this particular client is assigned.
string RESULT : NAME
The name of the customer
string RESULT : ATTENTION
The name of the attention person in the company
string RESULT : ADDRESS
The address of the customer.
string RESULT : POSTCODE
The postcode for the customer
string RESULT : CITY
The city the customer is in
string RESULT : COUNTRY
The country the customer is in
string RESULT : VAT_NUMBER
The vat number of the customer
string RESULT : INVOICE_EMAIL
The invoice mail of the customer - this is the email invoices raised to this customer will be send to.
string RESULT : PHONE
The phone number of the customer.
boolean RESULT : VAT_EXEMPT
TRUE or FALSE indicating whether the customer is marked as vat-exempt, i.e. foreign clients.
int STATUS_CODE
The status code of the function call, any code different from 0 is an error code
string STATUS_MESSAGE
A textual description of the status code in a few words

Potential error messages

2004: Invalid name
Occurs if the name supplied is not considered valid input, i.e. if its blank.
1007: Internal error
This is an unexpected error, and could indicate a bug in Uhasibu, if you see this bug occur then please report it to Uhasibu support.
1001: Invalid credentials
Occurs when no user is found within the given companyId using the login and password provided
1002: Missing access rights
Occurs when the user credentials provided does not have access-rights to use the required part of the system.
1003: Account expired
Occurs when the company is expired i.e. due to missing subscription payment.
1006: Requests method not supported
Occurs when the request is neither a POST nor GET HTTP request type

Examples

PHP example
$APIVersion = "20120401";

function uhasibu($method, $package) {
	global $APIVersion;
	$url = "www.uhasibu.co.ke/api/" . $APIVersion . $method;
	$curl = curl_init();
	curl_setopt($curl, CURLOPT_URL, $url);
	curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
	curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
	curl_setopt($curl, CURLOPT_POST, true);
	curl_setopt($curl, CURLOPT_POSTFIELDS, $package); 
	$response = curl_exec($curl);
	curl_close($curl);
	return json_decode($response, TRUE);
}

$package = 
	"companyId=**COMPANYID**" .
	"&login=" . urlencode("**USERNAME**") .
	"&password=" . urlencode("**PASSWORD**") .
	"&name=" . urlencode("Pluspeople Kenya LTD");

$response = uhasibu("/bookkeeping/getCustomerByName.php", $package);
if ($response["STATUS_CODE"] != 0) {
	die($response["STATUS_MESSAGE"]);
}

foreach ($response["RESULT"] AS $customer) {
	print "Customer Number: " . $customer["NUMBER"];
	print "Group id: " . $customer["GROUP_ID"];
	print "Currency id: " . $customer["CURRENCY_ID"];
	print "Payment term id: " . $customer["PAYMENT_TERM_ID"];
	print "Name: " . $customer["NAME];
	print "Attention: " . $customer["ATTENTION"];
	print "Address: " . $customer["ADDRESS"];
	print "Postcode: " . $customer["POSTCODE"];
	print "City: " . $customer["CITY"];
	print "Country: " . $customer["COUNTRY"];
	print "Vat number: " . $customer["VAT_NUMBER"];
	print "Invoice email: " . $customer["INVOICE_EMAIL"];
	print "Phone: " . $customer["PHONE"];
	print "VAT exempt: " . $customer["VAT_EXEMPT"];
}