Shoptrader API docs
Get - Options
Met deze API is het mogelijk om artikel opties uit te lezen
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 | integer | Nee | Stel een limiet in, gebruik all voor alle artikel opties, indien leeg standaard de eerste 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 = 'array'; // default array
$strUrl = 'http://' . $strApiBaseUrl . '/Api/Get/Options/?' . $strOutput;
// standaard parameters
$arrParams = array();
$arrParams['token'] = '8f00f89310945a0ca35666c8c9ced2e314e37aa6c32e900932e19902b42208767';
// custom parameters
$arrParams['language_id'] = 4;
$arrParams['limit'] = 2;
$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 (
[options] => Array (
[option] => Array (
[1] => Array (
[@attributes] => Array(
[option_id] => 1
)
[sort_order] => 0
[option_name] => Array (
[dutch] => Array (
[option_name] => Kleur
)
)
)
[2] => Array (
[@attributes] => Array (
[option_id] => 2
)
[sort_order] => 1
[option_name] => Array (
[dutch] => Array (
[option_name] => Maat
)
)
)
)
)
)
?>