我希望更新商家信息等列表属性 t,使用 php 批量定价。 我检查 Flipcart api doc https://seller.flipkart.com/api-docs/listing-api-docs/LMAPIRef.html我得到了这些参考:
https://api.flipkart.net/sellers/skus/listings/bulk
但我不知道如何传递参数所需的数据。有人这样做请回答。
答案 0 :(得分:0)
你好,文件是POST:
Body Parameter: BulkListingRequest (either listingId or skuId is mandatory)
URL: https://api.flipkart.net/sellers/skus/listings/bulk
Headers: Content-type:application/json
Response: BulkStatusOutput
使用这样的数据:
{
"listings": [
{
"skuId": "SKUID1",
"fsn": "FSN1",
"attributeValues": {
"mrp": "2400",
"selling_price": "2300",
"listing_status": "INACTIVE",
"fulfilled_by": "seller",
"national_shipping_charge": "20",
"zonal_shipping_charge": "20",
"local_shipping_charge": "20",
"procurement_sla": "3",
"stock_count": "23",
"procurement_type": "REGULAR"
}
}
}
所以你需要使用Curl:
$ch = curl_init( $url );
# Setup request to send json via POST.
$dataJson= json_encode($data));
curl_setopt( $ch, CURLOPT_POSTFIELDS, $dataJson);
curl_setopt( $ch, CURLOPT_HTTPHEADER, array('Content-Type:application/json'));
# Return response instead of printing.
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
# Send request.
$result = curl_exec($ch);
curl_close($ch);