Afonsoft.Amadeus
2.1.0
See the version list below for details.
dotnet add package Afonsoft.Amadeus --version 2.1.0
NuGet\Install-Package Afonsoft.Amadeus -Version 2.1.0
<PackageReference Include="Afonsoft.Amadeus" Version="2.1.0" />
paket add Afonsoft.Amadeus --version 2.1.0
#r "nuget: Afonsoft.Amadeus, 2.1.0"
// Install Afonsoft.Amadeus as a Cake Addin #addin nuget:?package=Afonsoft.Amadeus&version=2.1.0 // Install Afonsoft.Amadeus as a Cake Tool #tool nuget:?package=Afonsoft.Amadeus&version=2.1.0
Amadeus CSharp SDK
Amadeus provides a set of APIs for the travel industry. Flights, Hotels, Locations and more.
For more details see the on Amadeus.com.
Getting Started
To send make your first API call you will need to register for an Amadeus Developer Account and set up your first application.
using Afonsoft.Amadeus.Amadeus;
using Afonsoft.Amadeus.Params;
using Afonsoft.Amadeus.exceptions.ResponseException;
using Afonsoft.Amadeus.referenceData.Locations;
using Afonsoft.Amadeus.resources.Location;
public class AmadeusExample {
public static void main(String[] args) {
Amadeus amadeus = Amadeus
.builder("REPLACE_BY_YOUR_API_KEY", "REPLACE_BY_YOUR_API_SECRET")
.build();
Location[] locations = amadeus.referenceData.locations.get(Params
.with("keyword", "LON")
.and("subType", Locations.ANY));
}
}
Initialization
The client can be initialized directly.
//Initialize using parameters
Amadeus amadeus = Amadeus
.builder("REPLACE_BY_YOUR_API_KEY", "REPLACE_BY_YOUR_API_SECRET")
.build();
Alternatively it can be initialized without any parameters if the environment
variables AMADEUS_CLIENT_ID
and AMADEUS_CLIENT_SECRET
are present.
Your credentials can be found on the Amadeus dashboard. Sign up for an account today.
By default the environment for the SDK is the test
environment. To switch to
a production (paid-for) environment please switch the hostname
Documentation
Amadeus has a large set of APIs, and our documentation is here to get you started today. Head over to our Reference documentation for in-depth information about every SDK method, its arguments and return types.
Making API calls
This library conveniently maps every API path to a similar path.
For example, GET /v2/reference-data/urls/checkin-links?airlineCode=BA
would be:
amadeus.referenceData.urls.checkinLinks.get(Params.with("airlineCode", "BA"));
Similarly, to select a resource by ID, you can pass in the ID to the singular path.
For example, GET /v2/shopping/hotel-offers/XXX
would be:
amadeus.hotelOffer("XXX").get(...);
You can make any arbitrary API call as well directly with the .get
method.
Keep in mind, this returns a raw Resource
Resource resource = amadeus.get('/v2/reference-data/urls/checkin-links',
Params.with("airlineCode", "BA"));
resource.getResult();
Response
Every successful API call returns a Resource
object. The underlying
Resource
with the raw available.
Location[] locations = amadeus.referenceData.locations.get(Params
.with("keyword", "LON")
.and("subType", Locations.ANY));
// The raw response, as a string
locations[0].getResponse().getBody();
Pagination
If an API endpoint supports pagination, the other pages are available under the
.next
, .previous
, .last
and .first
methods.
Location[] locations = amadeus.referenceData.locations.get(Params
.with("keyword", "LON")
.and("subType", Locations.ANY));
// Fetches the next page
Location[] locations = (Location[]) amadeus.next(locations[0]);
If a page is not available, the method will return null
.
Logging & Debugging
The SDK makes it easy to add your own logger.
Additionally, to enable more verbose logging, you can set the appropriate level
on your own logger, though the easiest way would be to enable debugging via a
parameter on initialization, or using the AMADEUS_LOG_LEVEL
environment
variable.
License
This library is released under the MIT License.
Help
Our developer support team is here to help you. You can find us on StackOverflow and email.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- Microsoft.Extensions.Logging.Abstractions (>= 2.2.0)
- Newtonsoft.Json (>= 12.0.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Amadeus CSharp SDK - C# library for the Amadeus Self-Service travel APIs
Amadeus provides a set of APIs for the travel industry. Flights, Hotels, Locations and more.