Closed Treasureworth closed 1 year ago
Amadeus for Developers Self-Service APIs and the SDKs target to the followings URLs:
test.api.amadeus.com
for test usersapi.amadeus.com
for production usersThe endpoint you provide https://travel.api.amadeus.com/v1/reference-data/airlines
doesn't look like a Self-Service one.
Here is a full example for the API you try to call.
import com.amadeus.Amadeus;
import com.amadeus.Params;
import com.amadeus.exceptions.ResponseException;
import com.amadeus.resources.Airline;
public class Search {
public static void main(String[] args) throws ResponseException {
Amadeus amadeus = Amadeus
.builder("YOUR_API_KEY","YOUR_API_SECRET")
.build();
Airline[] airlines = amadeus.referenceData.airlines.get(Params
.with("airlineCodes", "BA"));
if (airlines[0].getResponse().getStatusCode() != 200) {
System.out.println("Wrong status code: " + airlines[0].getResponse().getStatusCode());
System.exit(-1);
}
System.out.println(airlines[0]);
}
}
Description
I followed through the initialisation step for Amadeus Java SDK but I am getting "Invalid access token" with "The access token provided in the Authorization header is invalid" as the error detail.
Steps to Reproduce
Expected Behavior: I expected to get Airline[] as the response.
Actual Behavior: The Log showed that a token was created but when call is made to https://travel.api.amadeus.com:443/v1/reference-data/airlines it returned an error that says that The access token provided in the Authorization header is invalid
Stable Behavior? This happens every of the time I tried to run my application.
Versions
[What version of Java/JVM are you running? What Operating System are you on?] Java 17. Mac OS Monterey Version 12.6