Shoptrader API docs
Get - Categories
Met deze API is het mogelijk om categorieën uit te lezen
Parameters
Parameter | Type | Verplicht | Omschrijving |
---|---|---|---|
token | string | Ja | Token, wordt verstrekt door Shoptrader op verzoek |
parent_id | integer | Nee | Indien leeg standaard waarde van 0 (Hoofdcategorieën) |
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 |
offset | integer | Nee | Stel een offset in, om bijvoorbeelde de volgende 10 op te halen, indien leeg standaard 0 |
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 = 'uwdomein.uwdomeinextentie';
$strOutput = 'xml';
$strUrl = 'http://' . $strApiBaseUrl . '/Api/Get/Categories/?' . $strOutput;
// standaard parameters
$arrParams = array();
$arrParams['token'] = '8f00f89310945a0ca35666c8c9ced2e314e37aa6c32e900932e19902b42208767';
// custom parameters
$arrParams['parent_id'] = 0;
$arrParams['language_id'] = 4;
$arrParams['limit'] = 'all';
// Of$arrParams['limit'] = 10;
$objCurl = curl_init();
curl_setopt($objCurl, CURLOPT_URL, $strUrl);
curl_setopt($objCurl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($objCurl, CURLOPT_TIMEOUT, 30);
curl_setopt($objCurl, CURLOPT_USERAGENT, 'Shoptrader');
curl_setopt($objCurl, CURLOPT_POST, true);
curl_setopt($objCurl, CURLOPT_POSTFIELDS, http_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] =>
)
)
)
)
)
?>