Shoptrader API docs

Image Description

Get - Categorie

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

Parameters

Parameter Type Verplicht Omschrijving
token string Ja Token, wordt verstrekt door Shoptrader op verzoek
category_id integer Ja Het id van de categorie
language_id integer Nee Indien leeg toon alle talen

PHP Example

<?php
ini_set
('max_execution_time'0);

$strApiBaseUrl 'uwdomein.uwdomeinextentie';
$strOutput 'xml';
$strUrl 'http://' $strApiBaseUrl '/Api/Get/Category/?' $strOutput;        

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

// custom parameters
$arrParams['category_id']    = 90;
$arrParams['language_id']     = 4;

$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 (
        [
1] => Array (
            [@
attributes] => Array (
                [
category_id] => 90
            
)
            [
categories_id] => 90
            
[categories_name] => VLOERTEGELS
            
[isActive] => 1
            
[inCategoriesBox] => 1
            
[inDropdownMenu] => 1
            
[onHomepage] => 0
            
[categories_image] => 
            [
categories_image_alt] => 
            [
parent_id] => 0
            
[sort_order] => 3
            
[date_added] => 01-01-2016
            
[last_modified] => 02-01-2016
            
[categories_name_languages] => Array (
                [
Dutch] => Array (
                    [
name] => VLOERTEGELS
                
)
            )
            [
description] => Array (
                [
Dutch] => Array (
                    [
aboveProducts] => Array (
                         [@
cdata] => Tekst boven de producten
                    
)
                    [
belowProducts] => Array (
                        [@
cdata] => Tekst onder de producten
                     
)
                )
            )
            [
meta] => Array (
                [
Dutch] => Array (
                    [
categories_seo_url] => test-vloer
                    
[categories_meta_title] => 
                    [
categories_meta_description] => 
                    [
categories_meta_keywords] => 
                )
            )
            [
advertentieplanet] => Array (
                [
advertentieplanet_categories_id] => 0
                
[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] => 
                )
            )
        )
    )
)
?>