flipkart的卖家API访问Product CakePHP列表

时间:2015-12-01 11:35:51

标签: flipkart-api

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

Flipkart API文档给出了滚滚网址

示例1 - 创建列表

成功:HTTP代码2xx flipkart的卖家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": []
    }
}

1 个答案:

答案 0 :(得分: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);