Getting a List of all Customers


#1

Hello,
I am building a web page that gets list of clients and locations on my server.
I am able to successfully get a list of all my location, however with the customers i am getting an error code 404.
I am new to programming, i didn’t fully understand your documentation on splynx APIs, perhaps a tutorial or an example on how to implement those codes will help a lot of us “beginners”

Here is the code is used.

include ‘splynxApi/SplynxApi.php’;

$splynx_url = ‘url"’;

$key = “key”;
$secret = “secret”;

$api = new SplynxAPI($splynx_url, $key, $secret);

$search = array(
‘main_attributes’ => array(
‘status’ => ‘active’
)
);

$customersApiUrl = “/admin/customers/list”.http_build_query($search);

print “

”;

print “List Customers\n”;
$result = $api->api_call_get($customersApiUrl);
print "Result: ";
if ($result) {
print “Ok!\n”;
print_r($api->response);
} else {
print “Fail! Error code: $api->response_code\n”;
print_r($api->response);
}

Kindly assist me on this…


#3

You have error in API url.
It must be like this:

$customersApiUrl = "admin/customers/customer?" . http_build_query($search);

API docs: http://docs.splynx.apiary.io/#reference/customers/customers-collection/list-all-customers