我正在使用Bigcommerce curl社区库PHP-cURL-lib-for-Bigcommerce-API。我用它完成了许多POST操作,没有任何问题。当我尝试创建这样的选项时:
$arrOptionImp["display_name"] = "Flavor";
$arrOptionImp["type"] = "cs";
$arrOptionImp["name"] = "Zuk-EndTrt Flavor";
try
{
$arrOptionResult = $objBigCom->post("/options", $arrOptionImp);
echo "Option Result<br />";
echo "<pre>";
print_r($arrOptionResult);
echo "</pre>";
}
catch(Exception $e)
{
echo 'Message: ' .$e->getMessage();
}
大商业回归:
Array
(
[type] => POST
[url] => https://www.myWebsite.com/api/v2/options/
[payload] => {"display_name":"Flavor","type":"cs","name":"Zuk-EndTrt Flavor"}
)
它应该返回这样的东西: 来自开发者dot bigcommerce dot com的json样本
{
"id": 10,
"name": "Color",
"type": "CS",
"values": {
"url": "https://store-bwvr466 dot mybigcommerce.com/api/v2/options/10/values.json",
"resource": "/options/10/values"
},
"display_name": "Color"
}
任何人都知道为什么我没有用选项Id获得结果?
答案 0 :(得分:1)
根据您的评论,请尝试:
$arrOptionImp["display_name"] = "Flavor";
$arrOptionImp["type"] = "CS";
$arrOptionImp["name"] = "Zuk-EndTrt Flavor";
try
{
$arrOptionResult = $objBigCom->post("/options", $arrOptionImp);
echo "Option Result<br />";
echo "<pre>";
print_r($arrOptionResult);
echo "</pre>";
}
catch(Exception $e)
{
echo 'Message: ' .$e->getMessage();
}