0

我正在开发代码以从 Flipkart 订单 api 获取所有订单和订单相关信息。调用货件详细信息 url 时出现错误。下面是我试过的代码:

$url  = "https://api.flipkart.net/sellers/v2/orders/shipments?orderItemsIds=1xxx68xxxx06xxxx";

$headers = array();
$headers[] = 'content-type: application/json';
$headers[] = 'Authorization:Bearer '.$access_token;//token value from above

$curl = curl_init(); 

curl_setopt($curl, CURLOPT_URL,$url);
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);//try to make it as true. making ssl verifyer as false will lead to security issues 

$response = curl_exec($curl);

$http = curl_getinfo($curl, CURLINFO_HTTP_CODE); // Response Code: 200 => Successful call
if (curl_errno($curl)) {
    echo 'Error:' . curl_error($curl);
}

$result = json_decode($response, true);

print_r($http);// get 400 here

print_r($result);//

输出是:

    Array
    (
        [0] => Array
            (
                [type] => 
                [code] => INVALID_ITEM_IDS
                [message] => Mandatory parameter orderItemIds missing
                [params] => Array
                    (
                    )
            )
    )

任何帮助,将不胜感激!

4

1 回答 1

0

$url = " https://api.flipkart.net/sellers/v2/orders/shipments?orderItemsIds=1xxx68xxxx06xxxx ";

这应该从 orderItemsIds 更改为 orderItemIds

于 2019-10-12T05:42:46.013 回答