Я могу сгенерировать access_token из производственной среды с помощью приведенного ниже кода
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.amadeus.com/v1/security/oauth2/token",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30000,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "client_id=XXX&client_secret=XXX&grant_type=client_credentials",
CURLOPT_HTTPHEADER => array(
// Set here requred headers
"accept: */*",
"accept-language: en-US,en;q=0.8",
"content-type: application/x-www-form-urlencoded",
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
, после чего я пытаюсь вызвать
https://api.amadeus.com/v1/shopping/flight-dates?origin=MAD&destination=MUC
API.Используя следующий код
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.amadeus.com/v1/shopping/flight-dates?origin=JFK&destination=LHR&oneWay=false&nonStop=false",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30000,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => array(
// Set here requred headers
"accept: */*",
"accept-language: en-US,en;q=0.8",
"content-type: application/x-www-form-urlencoded",
"Authorization: Bearer XXX",
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
я получаю следующую ошибку
{
"errors": [
{
"status": 401,
"title": "Wrong authentication credentials.",
"code": 701,
"source": {
"pointer": "shopping/flight-dates"
}
}
]
}
что я делаю не так.