我想更新列表属性,如库存计数,使用php批量定价。我检查了 Flipcart api doc https://seller.flipkart.com/api-docs/listing-api-docs/LMAPIRef.html我得到了这些参考:
https://api.flipkart.net/sellers/skus/listings/bulk
但我不知道如何传递参数所需的数据。有人这样做吗,请回答。
我想更新列表属性,如库存计数,使用php批量定价。我检查了 Flipcart api doc https://seller.flipkart.com/api-docs/listing-api-docs/LMAPIRef.html我得到了这些参考:
https://api.flipkart.net/sellers/skus/listings/bulk
但我不知道如何传递参数所需的数据。有人这样做吗,请回答。
从文档中您好,它是 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);