【发布时间】:2018-04-10 05:59:12
【问题描述】:
我正在从事 Bigcommerce 项目以导入类别。但在 Bigcommerce 中,我们没有直接导入选项,因此我使用 Category API V3 在 Bigcommerce 上创建类别。 类别创建成功。已创建图片的 bigcommerce CDN URL,但图片未显示在 bigcommerce 网站上。
仅供参考 - 我正在使用 Bigcommerce API V3
请找到API调用和API结果。错位见谅。
请在下面找到代码。
$fields = array("parent_id" => "27","name" => "category3","description" => "test description","image_url" => "https://imageurl/yhst-130038008324021_2510_1762695707");
$fields = json_encode($fields);
$api_url = 'https://api.bigcommerce.com/stores/storehash/v3/catalog/categories';
$ch = curl_init();
curl_setopt( $ch, CURLOPT_URL, $api_url );
curl_setopt($ch, CURLOPT_TIMEOUT, 100);
curl_setopt( $ch, CURLOPT_HTTPHEADER, array ('X-Auth-Client: client id','X-Auth-Token: auth token','Accept: application/json', 'Content-Type: application/json') );
curl_setopt( $ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, 0 );
curl_setopt( $ch, CURLOPT_POSTFIELDS, $fields);
curl_setopt( $ch, CURLOPT_USERPWD, "username:password" );
curl_setopt( $ch, CURLOPT_SSL_VERIFYHOST, 0 );
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 );
$response = curl_exec($ch);
$result = json_decode($response);
【问题讨论】:
-
请在您的问题中添加实际代码,而不是代码截图,因为人们可能想复制您的代码并自己尝试
-
您好,谢谢您的回复。我已经更新了我的代码
标签: bigcommerce