Flipkart API 的参考链接: https ://seller.flipkart.com/api-docs/listing-api-docs/LMAPIRef.html#postlisting-label
在沙盒环境中工作并使用沙盒 API url。如何在沙盒环境中创建列表。从生产中获取列表的任何其他方式。通过成功生成 access_token 完成。
enter code here
试过:
我的代码:
error_reporting(E_ALL); $url = "https://sandbox-api.flipkart.net/sellers/skus/SKUID/listings"; $curl = curl_init(); $data = '{ "fsn": "TSHEEG86JGBEABHS", "skuId": "P9_30Dec_20000942", "attributeValues": { "mrp": 140, "selling_price": "130", "listing_status": "INACTIVE", "fulfilled_by": "seller", "procurement_sla": "3", "stock_count": "23", "selling_region_restriction": "none", "procurement_type": "REGULAR" } }'; curl_setopt($curl, CURLOPT_URL,$url); curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "POST"); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl, CURLOPT_POSTFIELDS, $data ); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($curl, CURLOPT_HTTPHEADER , array('Accept:application/json','Content-type:application/json','Authorization:Bearer '.$access_token)); $result = curl_exec($curl); $header = curl_getinfo($curl); echo "Header :<pre>";print_r($header); echo 'result :';print_r($result); curl_close($curl);
请求网址:“ https://sandbox-api.flipkart.net/sellers/skus/SKUID/listings ”
要求 :
'{ “fsn”:“TSHEEG86JGBEABHS”, "skuId": "P9_30Dec_20000942", “属性值”:{ “mrp”:140, "sales_price": "130", “listing_status”:“不活跃”, "fulfilled_by": "卖家", "procurement_sla": "3", "stock_count": "23", "sales_region_restriction": "无", “采购类型”:“常规” } }'
Header :
<pre>
[url] => https://sandbox-api.flipkart.net/sellers/skus/SKUID/listings
[content_type] => text/plain
[http_code] => 400
[header_size] => 156
[request_size] => 687
[filetime] => -1
[ssl_verify_result] => 19
[redirect_count] => 0
[total_time] => 0.203
[namelookup_time] => 0
[connect_time] => 0.047
[pretransfer_time] => 0.156
[size_upload] => 485
[size_download] => 42
[speed_download] => 206
[speed_upload] => 2389
[download_content_length] => 42
[upload_content_length] => 485
[starttransfer_time] => 0.203
[redirect_time] => 0
[redirect_url] =>
[primary_ip] => 103.4.255.27
[certinfo] => Array
(
)
[primary_port] => 443
[local_ip] => 192.168.1.210
[local_port] => 50412
响应:无法从输入数据反序列化对象
我已经设定
curl_setopt($curl, CURLOPT_HTTPHEADER , array('Accept:application/json');仍然是它的节目
[content_type] => 文本/纯文本在我的标题中。
当我设置标题“授权:承载”时,内容类型更改为纯/文本提前谢谢请建议。