Shoptrader API docs

Image Description

Get - Categories

Met deze API is het mogelijk om alle categorieën uit te lezen waar als eerst de hoofdcategorieën getoond worden en daaronder de childs. Enz.

Parameters

Parameter Type Verplicht Omschrijving
token string Ja Token, wordt verstrekt door Shoptrader op verzoek
language_id integer Nee Indien leeg toon alle talen
limit string Nee U kunt een aantal meegeven of u kunt 'All' meegeven om alle op te halen. Indien leeg standaard waarde van 100
nested bool Nee Hier krijgt u alle hoofdcategorieën met alle onderliggende categorieën. 1 of 0.

PHP Example

<?php
ini_set
('max_execution_time'0);

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

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

// custom parameters
$arrParams['language_id']     = 4;
$arrParams['limit']         = 'all';
$arrParams['nested']         = 1;

$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)

<?php
Array (
    [
categories] => Array (
        [
72] => Array (
            [@
attributes] => Array (
                [
category_id] => 72
            
)
            [
category_id] => 72
            
[parent_id] => 0
            
[categories_name] => Accessoires nl
            
[isActive] => 1
            
[inCategoriesBox] => 1
            
[inDropdownMenu] => 1
            
[sorteerbalkWeergeven] => 0
            
[onHomepage] => 0
            
[categories_image] => 
            [
categories_image_alt] => 
            [
sort_order] => 0
            
[cPath] => 72
            
[categories_name_languages] => Array (
                [
dutch] => Array (
                    [
name] => Accessoires nl
                
)
            )
            [
description] => Array (
                [
dutch] => Array (
                    [
aboveProducts] => Array (
                        [@
cdata] => Testing nl
                    
)
                    [
belowProducts] => Array (
                        [@
cdata] => 
                    )
                )
            )
            [
meta] => Array (
                [
dutch] => Array (
                    [
categories_seo_url] => accessoires_test_nl
                    
[categories_meta_title] => 
                    [
categories_meta_description] => 
                    [
categories_meta_keywords] => 
                )
            )
            [
advertentieplanet] => Array (
                [
advertentieplanet_category_id] => 
                [
advertentieplanet_nice_name] => 
            )
            [
beslist] => Array (
                [
beslist_nice_name] => 
            )
            [
google] => Array (
                [
google_shopping_nice_name] => 
            )
            [
marktplaats] => Array (
                [
categories_adTtlBudg] => 50.00
                
[categories_adDayBudg] => 0.00
                
[categories_adCPC] => 0.01
                
[adGroup_id] => 0
                
[adParent_id] => 0
                
[adPrijstype_id] => 0
                
[categories_adOnderschrift] => Array (
                    [@
cdata] => 
                )
            )
            [
childs] => Array (
                [
categories] => Array (
                    [
76] => Array (
                        [@
attributes] => Array (
                            [
category_id] => 76
                        
)
                        [
category_id] => 76
                        
[parent_id] => 72
                        
[categories_name] => Child cat
                        
[isActive] => 1
                        
[inCategoriesBox] => 1
                        
[inDropdownMenu] => 1
                        
[sorteerbalkWeergeven] => 0
                        
[onHomepage] => 0
                        
[categories_image] => 
                        [
categories_image_alt] => 
                        [
sort_order] => 0
                        
[cPath] => 76
                        
[categories_name_languages] => Array (
                            [
dutch] => Array (
                                [
name] => Child cat
                            
)
                        )
                        [
description] => Array (
                            [
dutch] => Array (
                                [
aboveProducts] => Array (
                                    [@
cdata] => 
                                )
                                [
belowProducts] => Array (
                                    [@
cdata] => 
                                )
                            )
                        )
                        [
meta] => Array (
                            [
dutch] => Array (
                                [
categories_seo_url] => child-cat
                                
[categories_meta_title] => 
                                [
categories_meta_description] => 
                                [
categories_meta_keywords] => 
                            )
                        )
                        [
advertentieplanet] => Array (
                            [
advertentieplanet_category_id] => 
                            [
advertentieplanet_nice_name] => 
                        )
                        [
beslist] => Array (
                            [
beslist_nice_name] => 
                        )
                        [
google] => Array (
                            [
google_shopping_nice_name] => 
                        )
                        [
marktplaats] => Array (
                            [
categories_adTtlBudg] => 50.00
                            
[categories_adDayBudg] => 
                            [
categories_adCPC] => 0.01
                            
[adGroup_id] => 
                            [
adParent_id] => 0
                            
[adPrijstype_id] => 
                            [
categories_adOnderschrift] => Array (
                                [@
cdata] => 
                            )
                        )
                        [
childs] => 
                    )
                )
            )
        )
    )
)
?>