Shoptrader API docs
Get - Option value
Met deze API is het mogelijk om een artikel optie value uit te lezen
Parameters
Parameter | Type | Verplicht | Omschrijving |
---|---|---|---|
token | string | Ja | Token, wordt verstrekt door Shoptrader op verzoek |
option_value_id | integer | Ja | ID van de artikel optie value |
PHP Example
<?php
ini_set('max_execution_time', 0);
$strApiBaseUrl = 'uwdomeinnaam.uwdomeinextentie';
$strOutput = ''; // default array
$strUrl = 'http://' . $strApiBaseUrl . '/Api/Get/OptionValue/?' . $strOutput;
// standaard parameters
$arrParams = array();
$arrParams['token'] = '8f00f89310945a0ca35666c8c9ced2e314e37aa6c32e900932e19902b42208767';
// custom parameters
$arrParams['option_value_id'] = 1;
$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(
[option_values] => Array (
[option_value] => Array (
[1] => Array (
[@attributes] => Array (
[option_value_id] => 1
)
[option_id] => 1
[sort_order] => 0
[option_value_name] => Array (
[dutch] => Array (
[option_value_name] => Aluminium/Grijs
)
)
)
)
)
)
?>