amadeus-java | Java library for the Amadeus Self-Service travel APIs | SDK library
kandi X-RAY | amadeus-java Summary
kandi X-RAY | amadeus-java Summary
Amadeus provides a rich set of APIs for the travel industry. For more details, check out the Amadeus for Developers Portal or the SDK class reference.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Retrieves the first page of the given resource
- Writes the parameters to the request
- Tries to read the response body
- Detect exceptions
- Retrieves the first page of a given response
- Writes the parameters to the request
- Tries to read the response body
- Detect exceptions
- Retrieves the last page for a resource
- Converts the parameters into a HTTP query string
- Converts the parameters into an HTTP query string
- Retrieves the previous page for the given resource
- Fetches the previous page of a given response
- Retrieves the next page for a given resource
- Retrieves the next page of the given response
- Fetches the last page of the response
- Returns a list of all relevant hotel items
- Make a GET request for the specified path
- Prepares the URL for this request
- Gets the serialized query parameters
- Prepares the HTTP headers for this request
- Builds the user - agent header
- Main entry point
- Get the hotel ratings
- Determines the code
amadeus-java Key Features
amadeus-java Examples and Code Snippets
// Flight Inspiration Search
FlightDestination[] flightDestinations = amadeus.shopping.flightDestinations.get(Params
.with("origin", "MAD"));
// Flight Cheapest Date Search
FlightDate[] flightDates = amadeus.shopping.flightDates.get(Params
.with
import com.amadeus.Amadeus;
import com.amadeus.Params;
import com.amadeus.exceptions.ResponseException;
import com.amadeus.referenceData.Locations;
import com.amadeus.resources.Location;
public class AmadeusExample {
public static void main(Strin
import java.util.logging.Logger;
// Assumes the current class is called MyLogger
private final static Logger LOGGER = Logger.getLogger(MyLogger.class.getName());
...
Amadeus amadeus = Amadeus
.builder("REPLACE_BY_YOUR_API_KEY", "REPLACE_BY
Community Discussions
Trending Discussions on amadeus-java
QUESTION
If I try to return FlightOfferSearch[] or FlightOrder objects from a handler method of my Spring Boot REST Controller, they don't seem to get serialized correctly like simpler POJOs I've worked with before where Jackson handled JSON serialization.
My code (actual API calls mostly identical to the SDK github example):
...ANSWER
Answered 2020-Apr-21 at 13:27I reworked the Java SDK helpers to fix and add a couple of things:
- Fix a bug that was trying to book all the flights of the search.
- Added a new method allowing you to book using a single FlightOfferSearch (not an array)
- I added a method to book from a FlightPrice object. In theory, you shouldn't book from a FlightOfferSearch directly, you should call the Flight Offers Price API to confirm the price and availability before booking. You can find an example here. You can learn more about the flight booking flow in this tutorial.
For your information, all our APIs support the post with a JSON direclty (in String or in JsonObject) if any of our helpers fail you can use that method (take your object, deserialize it in String/JSON and use it directly).
I released a new version of the SDK version 4.1.0
please update to this version.
QUESTION
I have trouble deserializing the Response Example JSON for a FlightOfferSearch
from here when passing it to my test REST controller:
ANSWER
Answered 2020-Apr-21 at 12:39You probably didn't create setters for some of the fields for your parameter class, but the problem lies deeper - your way of handling this, is incorrect.
Spring's @RestController
converts incoming payload from JSON to the object parameter of the controller method by default and converts return object to JSON.
You don't need to include any extra dependencies apart spring-boot-starter-web
, which includes a default Jackson JSON mapper.
But even if you do use gson
instead, Spring still will work this exact way only it'll use gson
instead.
Everything you need to do is to create a class, which represents your incoming json correctly and use that class as a parameter, it has to have an empty constructor, setters if you use this object as a request body and getters if you use that object as a response body.
UPD: If you don't own the object you are using as a controller method's parameter - I recommend creating custom POJO anyway, using non-incapsulated third-party library considered a smell at least, it violates the encapsulation and creates tight coupling to the third-party library.
QUESTION
I understand that the amadeus-java SDK offers methods that simplify GET and POST calls to the Amadeus Self-Service API endpoint Flight Offers Search.
Is there a way to make POST calls to Flight Offers Price and Flight Create Orders within the SDK?
If the SDK does not have methods for this, how would I retrieve the access token I fetched via SDK to make those calls explicitly?
Thanks in advance!
...ANSWER
Answered 2020-Mar-13 at 11:38Flight Offers Price and Flight Create Orders are about to be integrated into the Java SDK (PRs opened, a bit more work to do and you will be able to use them).
The other solution will be to use the methods post
and get
directly from our client like in the example below (that you can find the README description of the Java SDK):
You can make any arbitrary API call as well directly with the .get method. Keep in mind, this returns a raw Resource
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install amadeus-java
To make your first API call, you will need to register for an Amadeus Developer Account and set up your first application.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page