flipkart API的参考链接: https://seller.flipkart.com/api-docs/listing-api-docs/LMAPIRef.html#postlisting-label
在沙箱环境中工作并使用沙盒API网址。 如何在沙箱环境中创建列表。任何其他方式从production.Done获得列表,成功生成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”
请求:
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
'{ "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" } }'
回应: 无法从输入数据反序列化对象
我已在我的标题中设置
std::copy(queue::front(), queue::back(), array);
仍然显示curl_setopt($curl, CURLOPT_HTTPHEADER , array('Accept:application/json');。
当我设置标题'Authorization:Bearer'时,Content-type更改为plain / text 在此先感谢,请建议。