所以试图在沙盒上发布产品列表,但它首先显示像 Invalid Fsn 这样的错误我尝试了使用下面的 url https://sandbox-api.flipkart.net/oauth-service/oauth/token?grant_type=使用令牌响应的身份验证client_credentials&scope=Seller_Api 然后我尝试使用下面的 url https://sandbox-api.flipkart.net/sellers/listings/v3使用卖家 api 发布列表
但作为回应,它显示以下错误
{"sku":{"status":"FAILURE","errors":[{"severity":"ERROR","code":25001,"description":"Invalid FSN abc."}]}}
我的代码是
$url = "https://sandbox-api.flipkart.net/oauth-service/oauth/token?grant_type=client_credentials&scope=Seller_Api";
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL,$url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_USERPWD, "app id:app secret");
$result = curl_exec($curl);
curl_close($curl);
$tokan = json_decode($result,true);
$url = "https://sandbox-api.flipkart.net/sellers/listings/v3";
$curl = curl_init();
$json = '{
"sku": {
"product_id": "abc",
"price": {
"mrp": 100,
"selling_price": 100,
"currency": "INR"
},
"tax": {
"hsn": "39264099",
"tax_code" : "GST_5"
},
"listing_status": "ACTIVE",
"shipping_fees": {
"local": 0,
"zonal": 0,
"national": 0,
"currency": "INR"
},
"fulfillment_profile": "NON_FBF",
"fulfillment": {
"dispatch_sla": 1,
"shipping_provider": "SELLER",
"procurement_type": "REGULAR"
},
"packages": [
{
"name": "RHBUS001",
"dimensions": {
"length": 1,
"breadth": 1,
"height": 1
},
"weight": 1,
"description": "",
"handling": {
"fragile": true
},
"notional_value": {
"amount": 1,
"unit": "PERCENTAGE"
}
}
],
"locations": [
{
"id": "WH",
"status": "ENABLED",
"inventory": 1
}
]
}
}';
curl_setopt($curl, CURLOPT_URL,$url);
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, $json);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_HTTPHEADER, array(
'Content-Type:application/json',
'Authorization:Bearer '.$tokan['access_token'],
''
));
$result = curl_exec($curl);
$ee = curl_getinfo($curl);
echo "<pre>";
print_r($ee);
curl_close($curl);
print_r($result);