3

我想访问此网站的 API https://seller.flipkart.com/api-docs/listing-api-docs/LMAPIRef.html我已经生成了令牌,但后来​​我想访问我在 Flipkart 上上传的产品列表

Flipkart API 文档给出了波涛汹涌的 URL

示例 1 - 创建列表

成功:使用此链接访问产品列表的 Flipkart 的 HTTP 代码 2xx 卖家 API 请求:https ://api.flipkart.net/sellers/skus/SKUID/listings

{
    "skuId": "SKUID",
    "fsn": "FSN",
    "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"
    }
}

回复:

{
    "status": "success",
    "response": {
        "skuId": "SKUID",
        "listingId": "LISTINGID",
        "status": "created",
        "errors": []
    }
}
4

1 回答 1

6

$url = "https://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://api.flipkart.net/sellers/v2/orders/search"; $curl = curl_init(); $json = '{ "filter": { "orderDate": { "fromDate": "2016-01-01T19:00:00Z", "toDate": "2016-03-28T19:00:00Z" } } }'; 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);

于 2016-03-28T10:50:19.407 回答