Reference link for flipkart API : https://seller.flipkart.com/api-docs/listing-api-docs/LMAPIRef.html#postlisting-label
working in sandbox environment and using sandbox API url. How to create listing in sandbox environment. Any other way to get listing from production.Done with successful generation of access_token.
enter code here
Tried:
my code :
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);
Request URL : " https://sandbox-api.flipkart.net/sellers/skus/SKUID/listings "
Request :
'{ "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" } }'
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
Response : Can not deserialize object from input data
I have set
curl_setopt($curl, CURLOPT_HTTPHEADER , array('Accept:application/json');still its show
[content_type] => text/plainin my header.
When I set header 'Authorization: Bearer', Content-type change to plain /text Thanks in advance please suggest.