Shoptrader API docs

Image Description

Get - Customers

Met deze API is het mogelijk om een klant uit te lezen

Parameters

Parameter Type Verplicht Omschrijving
token string Ja Token, wordt verstrekt door Shoptrader op verzoek
limit integer Nee Stel een limiet in, bijvoorbeeld de laatste 10, gebruik all voor alle klanten, indien leeg standaard de laatste 100
offset integer Nee Stel een offset in, om bijvoorbeelde de volgende 10 op te halen, indien leeg standaard 0

PHP Example

<?php
ini_set
('max_execution_time'0);

$strApiBaseUrl 'uwdomeinnaam.uwdomeinextentie';
$strOutput 'xml';
$strUrl 'http://' $strApiBaseUrl '/Api/Get/Customers/?' $strOutput;        

// standaard parameters
$arrParams = array();
$arrParams['token']         = '8f00f89310945a0ca35666c8c9ced2e314e37aa6c32e900932e19902b42208767';

// custom parameters
$arrParams['limit']         = 100;

$objCurl curl_init();
curl_setopt($objCurlCURLOPT_URL$strUrl);
curl_setopt($objCurlCURLOPT_RETURNTRANSFERtrue);
curl_setopt($objCurlCURLOPT_TIMEOUT30);
curl_setopt($objCurlCURLOPT_USERAGENT'Shoptrader');
curl_setopt($objCurlCURLOPT_POSTtrue);
curl_setopt($objCurlCURLOPT_POSTFIELDShttp_build_query($arrParams));

// execute cURL, array, xml output
$strCurlData curl_exec($objCurl);
if (
$strCurlData === FALSE) {
    echo 
"cURL Error: " curl_error($objCurl);
} else {
    
print_r($strCurlData);
}

// execute cURL, array, xml output
// $strCurlData = curl_exec($objCurl);
// if ($strCurlData === FALSE) {
//    echo "cURL Error: " . curl_error($objCurl);
// } else {
//    $arrShopResult = json_decode($strCurlData, true);
//    print_r($arrShopResult);
// }
?>

Resultaat (array)

hasNewsletter geeft aan of de klant ingeschreven staat voor de nieuwsbrief. isPrimary geeft aan wat het hoofdadres is van de klant, indien de klant bijvoorbeeld meerdere verzend -of factuuradressen heeft aangemaakt.

<?php
Array(
    [
customers] => Array(        
        [
886] => Array(                
            [@
attributes] => Array(                        
                [
customer_id] => 886
            
)
            [
account] => Array(                        
                    [
firstname] => Support
                    
[lastname] => Shoptrader
                    
[telephone] => 0206242439
                    
[fax] => 0206361132
                    
[bank_number] => 
                    [
date_of_birth] => 
                    [
email_address] => support@shoptrader.nl
                    
[has_newsletter] => No
                    
[created_on] => 03-01-2016 00:03:33
                    
[last_modified] => 
                    [
last_login] =>
                    [
default_billing_id] => 13416
                    
[default_shipping_id] => 13416
                
)
            [
address] => Array(                       
                [
address_book] => Array(                                
                    [
1021] => Array(                                        
                        [@
attributes] => Array(                                                
                            [
address_book_id] => 1021
                        
)
                        [
default_billing] => Yes
                        
[default_shipping] => Yes
                        
[gender] => M
                        
[company] => Shoptrader
                        
[coc_number] => 34211339
                        
[vat_number] => NL820726473B01
                        
[firstname] => Support
                        
[lastname] => Shoptrader
                        
[address] => Wilgenweg
                        
[house_number] => 26
                        
[house_number_addition] => B
                        
[zip_code] => 1031 HV
                        
[state] => 
                        [
city] => Amsterdam
                        
[country] => Nederland
                        
[country_iso_code_short] => NL
                        
[country_iso_code_long] => NLD
                    
)
                    [
1022] => Array(                                        
                        [@
attributes] => Array(                                            
                            
address_book_id] => 1022
                        
)
                        [
default_billing] => No
                        
[default_shipping] => No
                        
[gender] => M
                        
[company] => Shoptrader
                        
[coc_number] => 34211339
                        
[vat_number] => NL820726473B01
                        
[firstname] => Support
                        
[lastname] => Shoptrader
                        
[address] => Wilgenweg
                        
[house_number] => 26
                        
[house_number_addition] => B
                        
[zip_code] => 1031 HV
                        
[state] => 
                        [
city] => Amsterdam
                        
[country] => Nederland
                        
[country_iso_code_short] => NL
                        
[country_iso_code_long] => NLD
                    
)
                    [
1028] => Array(                                        
                        [@
attributes] => Array(                                            
                            [
address_book_id] => 1028
                        
)
                        [
default_billing] => No
                        
[default_shipping] => No
                        
[gender] => M
                        
[company] => Shoptrader
                        
[coc_number] => 34211339
                        
[vat_number] => NL820726473B01
                        
[firstname] => Support
                        
[lastname] => Shoptrader
                        
[address] => Wilgenweg
                        
[house_number] => 26
                        
[house_number_addition] => B
                        
[zip_code] => 1031 HV
                        
[state] => 
                        [
city] => Amsterdam
                        
[country] => Nederland
                        
[country_iso_code_short] => NL
                        
[country_iso_code_long] => NLD
                    
)
                )
            )
        )
    )
)
?>