Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions docs/API-Keys/authorization.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,10 @@ The following example uses `cURL` to request a new token:
```bash
curl "https://test.api.amadeus.com/v1/security/oauth2/token" \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "grant_type=client_credentials&client_id={client_id}&client_secret={client_secret}"
-d "grant_type=client_credentials&client_id=<YOUR-CLIENT-ID>&client_secret=<YOUR-CLIENT-SECRET>"
```
Replace `<YOUR-CLIENT-ID>` with your API Key and `<YOUR-CLIENT-SECRET>` with your API Secret in the command above.

Note that the `-X POST` parameter is not needed in the `cURL` command. As we are sending a body, `cURL` sends the request as `POST` automatically.

## Response
Expand Down Expand Up @@ -67,14 +69,15 @@ The response will contain the following parameters:

Once the token has been retrieved, you can authenticate your requests to Amadeus Self-Service APIs.

Each API call must contain the `authorization` HTTP header with the value `Bearer {access_token}`, where `acess_token` is the token you have just retrieved.
Each API call must contain the `authorization` HTTP header with the value `Bearer <access_token>`, where `<acess_token>` is the token you have just retrieved.

The following example is a call to the `Flight Check-in Links` API to retrieve the check-in URL for Iberia \(`IB`\):

```bash
curl "https://test.api.amadeus.com/v2/reference-data/urls/checkin-links?airline=IB" \
-H "Authorization: Bearer CpjU0sEenniHCgPDrndzOSWFk5mN"
-H "Authorization: Bearer <YOUR-BEARER-TOKEN>"
```
Replace `<YOUR-BEARER-TOKEN>` with the token you received from the authorization call.

## Managing tokens from your source code

Expand All @@ -92,10 +95,11 @@ Example of initializing the client and authenticating with the `Node` SDK:
var Amadeus = require('amadeus');

var amadeus = new Amadeus({
clientId: '[API Key]',
clientSecret: '[API Secret]'
clientId: '<YOUR-CLIENT-ID>',
clientSecret: '<YOUR-CLIENT-SECRET>'
});
```
Replace `<YOUR-CLIENT-ID>` with your API Key and `<YOUR-CLIENT-SECRET>` with your API Secret.

You can then call the API. The following example is a call to the `Flight Check-in Links` API to retrieve the check-in URL for Iberia \(`IB`\):

Expand All @@ -104,8 +108,8 @@ You can then call the API. The following example is a call to the `Flight Check-
var Amadeus = require('amadeus');

var amadeus = new Amadeus({
clientId: '[API Key]',
clientSecret: '[API Secret]'
clientId: '<YOUR-CLIENT-ID>',
clientSecret: '<YOUR-CLIENT-SECRET>'
});

amadeus.referenceData.urls.checkinLinks.get({
Expand All @@ -116,4 +120,5 @@ amadeus.referenceData.urls.checkinLinks.get({
console.log(responseError.code);
});
```
Replace `<YOUR-CLIENT-ID>` with your API Key and `<YOUR-CLIENT-SECRET>` with your API Secret.

17 changes: 9 additions & 8 deletions docs/API-Keys/moving-to-production.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ When your application is ready to be deployed to the Real World™, you can requ
To request a **production key**, you must complete the following steps:

1. [Sign in](https://developers.amadeus.com/signin){:target="\_blank"} to your account and enter [My Self-Service Workspace](https://developers.amadeus.com/my-apps){:target="\_blank"}.
2. Select the application to move to `Production` and click `Get Production environment` :
2. Select the application to move to `Production` and click `Get production environment` :

![request_prod](../images/api-keys/moving-to-production/request_production_key.png)
![request_prod](../images/api-keys/moving-to-production/request_production_key.png)

3. Complete the form with your personal information, billing address, and app information.
4. Indicate whether your application uses `Flight Create Orders` in the checkbox at the bottom of the form. This API has special access requirements detailed below in the `Moving to Production with Flight Create Orders` section of this guide.
Expand All @@ -25,8 +25,8 @@ You will receive a notification that your application is validated and the statu

![live](../images/api-keys/moving-to-production/app_live.png)

> Production keys are valid for all Self-Service APIs except `Flight Create Orders API`, which has special requirements. See the `Moving to Production with Flight Create Orders` of this guide for more information.

!!!information
Production keys are valid for all Self-Service APIs except `Flight Create Orders API`, which has special requirements. See the `Moving to Production with Flight Create Orders` of this guide for more information.

Remember that once you exceed your free transactions threshold, you will be billed automatically for your transactions every month. You can manage and track your app usage in [My Self-Service Workspace](https://developers.amadeus.com/my-apps){:target="\_blank"}.

Expand All @@ -43,8 +43,8 @@ If you are using [Amadeus for Developers SDKs](https://github.com/amadeus4dev){:
from amadeus import Client, ResponseError

amadeus = Client(
client_id='REPLACE_BY_YOUR_API_KEY',
client_secret='REPLACE_BY_YOUR_API_SECRET',
client_id='<YOUR-CLIENT-ID>',
client_secret='<YOUR-CLIENT-SECRET>',
hostname='production'
)

Expand All @@ -57,7 +57,8 @@ try:
print(response.data)
except ResponseError as error:
print(error)
```
```
Replace `<YOUR-CLIENT-ID>` with your API Key and `<YOUR-CLIENT-SECRET>` with your API Secret in the command above.

## Video Tutorial

Expand All @@ -79,7 +80,7 @@ Applications using `Flight Create Orders` must meet special requirements before

2. **There are no restrictions in your country**. Though we are working to make Self-Service flight booking available worldwide, `Flight Create Orders` API is currently not available to companies in the following countries:

*Algeria, Bangladesh, Bhutan, Bulgaria, Croatia, Egypt, Finland, Iceland,
*Algeria, Bangladesh, Bhutan, Bulgaria, Croatia, Egypt, Finland, Iceland,
Iran, Iraq, Jordan, Kuwait, Kosovo, Lebanon, Libya, Madagascar, Maldives,
Montenegro, Morocco, Nepal, Pakistan, Palestine, Qatar, Saudi Arabia, Serbia, Sri Lanka, Sudan, Syria, Tahiti, Tunisia, United Arab Emirates and
Yemen*
Expand Down
1 change: 1 addition & 0 deletions docs/developer-tools/graphql/rest-to-graphql-export.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,3 +78,4 @@ server.listen().then(({ url }) => {
console.log(`🚀 Server ready at ${url}`);
});
```
Replace `<path-to-generated-graphql-schema>` with the path to the schema generated in the **Convert** step.
3 changes: 2 additions & 1 deletion docs/developer-tools/graphql/rest-to-graphql-node.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,10 @@ Now that we have the server running, we can send requests to it. The most straig
```shell
curl -X POST \
-H "Content-Type: application/json" \
-H "Authorization: <your_bearer_token>" \
-H "Authorization: <YOUR-BEARER-TOKEN>" \
-d '{ "query": "{ getCities(keyword: \"PARIS\") { name } }" }' \
http://localhost:4000/
```
Replace `<YOUR-BEARER-TOKEN>` with the token you received from the authorization call.

If your token is valid, the above command will return a list of city names that contain the word `Paris`.
3 changes: 2 additions & 1 deletion docs/developer-tools/graphql/rest-to-graphql-python.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,10 @@ Now that we have the server running, we can send requests to it. The most straig
```shell
curl -X POST \
-H "Content-Type: application/json" \
-H "Authorization: <your_bearer_token>" \
-H "Authorization: <YOUR-BEARER-TOKEN>" \
-d '{ "query": "{ getCities(keyword: \"PARIS\") { name } }" }' \
http://localhost:8000/
```
Replace `<YOUR-BEARER-TOKEN>` with the token you received from the authorization call.

If your token is valid, the above command will return a list of city names that contain the word `Paris`.
11 changes: 6 additions & 5 deletions docs/developer-tools/java.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ compile "com.amadeus:amadeus-java:7.0.0"

**Further information:**

You can check the library in the [Maven repository](https://mvnrepository.com/artifact/com.amadeus/amadeus-java/latest){:target="\_blank"} for futher information.
You can check the library in the [Maven repository](https://mvnrepository.com/artifact/com.amadeus/amadeus-java/latest){:target="\_blank"} for further information.

### Step-by-step example

This tutorial will guide you through the process of creating a simple Java
application which calls the Flight Inspiration Search API using the Amadeus
application which calls the [Flight Inspiration Search API](https://developers.amadeus.com/self-service/category/flights/api-doc/flight-inspiration-search){:target="\_blank"} using the Amadeus
for Developers Java SDK.

### Using the Amadeus Java SDK
Expand Down Expand Up @@ -85,9 +85,10 @@ public class FlightSearch {
Before testing the example, export your credentials in your terminal:

```bash
export AMADEUS_CLIENT_ID=YOUR_CLIENT_ID
export AMADEUS_CLIENT_SECRET=YOUR_CLIENT_SECRET
export AMADEUS_CLIENT_ID=<YOUR-CLIENT-ID>
export AMADEUS_CLIENT_SECRET=<YOUR-CLIENT-SECRET>
```
Replace `<YOUR-CLIENT-ID>` with your API Key and `<YOUR-CLIENT-SECRET>` with your API Secret in the command above.

Let's build and run the code to make sure that everything is working properly:

Expand Down Expand Up @@ -152,4 +153,4 @@ You can also check the video tutorial on how to get started with the Java SDK.

### Managing API rate limits

[Amadeus Self-Service APIs](https://developers.amadeus.com/self-service){:target="\_blank"} have [rate limits](../api-rate-limits.md){:target="\_blank"} in place to protect against abuse by third parties. You can find Rate limit example in Java using the Amadeus Java SDK [here](https://github.com/amadeus4dev-examples/APIRateLimits/tree/master/Java){:target="\_blank"}.
[Amadeus Self-Service APIs](https://developers.amadeus.com/self-service){:target="\_blank"} have [rate limits](../api-rate-limits.md){:target="\_blank"} in place to protect against abuse by third parties. You can find Rate limit example in Java using the Amadeus Java SDK [here](https://github.com/amadeus4dev-examples/APIRateLimits/tree/master/Java){:target="\_blank"}.
24 changes: 14 additions & 10 deletions docs/developer-tools/node.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ To make your first API call, you will need to [register](https://developers.amad
```js
var Amadeus = require('amadeus');
var amadeus = new Amadeus({
clientId: 'REPLACE_BY_YOUR_API_KEY',
clientSecret: 'REPLACE_BY_YOUR_API_SECRET'
clientId: '<YOUR-CLIENT-ID>',
clientSecret: '<YOUR-CLIENT-SECRET>'
});

amadeus.shopping.flightOffersSearch.get({
Expand All @@ -35,6 +35,7 @@ amadeus.shopping.flightOffersSearch.get({
console.log(responseError.code);
});
```
Replace `<YOUR-CLIENT-ID>` with your API Key and `<YOUR-CLIENT-SECRET>` with your API Secret in the command above.

### Initialization

Expand All @@ -44,10 +45,11 @@ The client can be initialized directly as below. Your credentials `client Id` an
```js
// Initialize using parameters
var amadeus = new Amadeus({
clientId: 'REPLACE_BY_YOUR_API_KEY',
clientSecret: 'REPLACE_BY_YOUR_API_SECRET'
clientId: '<YOUR-CLIENT-ID>',
clientSecret: '<YOUR-CLIENT-SECRET>'
});
```
Replace `<YOUR-CLIENT-ID>` with your API Key and `<YOUR-CLIENT-SECRET>` with your API Secret in the command above.

!!! warning
Remember that hardcoding your credentials is not the best practice due to the potential exposure to others. Read more about best practices for [secure API key storage](https://developers.amadeus.com/blog/best-practices-api-key-storage){:target="\_blank"}.
Expand All @@ -62,9 +64,10 @@ npm install dotenv
Put your API credentials in `.env` file:

```sh
AMADEUS_CLIENT_ID=REPLACE_BY_YOUR_API_KEY,
AMADEUS_CLIENT_SECRET=REPLACE_BY_YOUR_API_SECRET
AMADEUS_CLIENT_ID=<YOUR-CLIENT-ID>,
AMADEUS_CLIENT_SECRET=<YOUR-CLIENT-SECRET>
```
Replace `<YOUR-CLIENT-ID>` with your API Key and `<YOUR-CLIENT-SECRET>` with your API Secret in the command above.

Initialize using dotenv package:

Expand All @@ -81,10 +84,11 @@ If you don't want to use another package, you can also simply export your key in
Export your credentials in terminal:

```sh
export AMADEUS_CLIENT_ID="REPLACE_BY_YOUR_API_KEY"
export AMADEUS_CLIENT_SECRET="REPLACE_BY_YOUR_API_SECRET"

export AMADEUS_CLIENT_ID="<YOUR-CLIENT-ID>"
export AMADEUS_CLIENT_SECRET="<YOUR-CLIENT-SECRET>"
```
Replace `<YOUR-CLIENT-ID>` with your API Key and `<YOUR-CLIENT-SECRET>` with your API Secret in the command above.

Initialize:

```js
Expand Down Expand Up @@ -149,4 +153,4 @@ You can also check the video tutorial on how to get started with the Node SDK.

### Managing API rate limits

[Amadeus Self-Service APIs](https://developers.amadeus.com/self-service){:target="\_blank"} have [rate limits](../api-rate-limits.md){:target="\_blank"} in place to protect against abuse by third parties. You can find Rate limit example in Node using the Amadeus Node SDK [here](https://github.com/amadeus4dev-examples/APIRateLimits){:target="\_blank"}.
[Amadeus Self-Service APIs](https://developers.amadeus.com/self-service){:target="\_blank"} have [rate limits](../api-rate-limits.md){:target="\_blank"} in place to protect against abuse by third parties. You can find Rate limit example in Node using the Amadeus Node SDK [here](https://github.com/amadeus4dev-examples/APIRateLimits){:target="\_blank"}.
6 changes: 4 additions & 2 deletions docs/developer-tools/php.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ use Amadeus\Exceptions\ResponseException;
require __DIR__ . '/vendor/autoload.php'; // include composer autoloader

try {
$amadeus = Amadeus::builder("REPLACE_BY_YOUR_API_KEY", "REPLACE_BY_YOUR_API_SECRET")
$amadeus = Amadeus::builder("<YOUR-CLIENT-ID>", "<YOUR-CLIENT-SECRET>")
->build();

// Flight Offers Search GET
Expand Down Expand Up @@ -72,6 +72,8 @@ try {
print $e;
}
```
Replace `<YOUR-CLIENT-ID>` with your API Key and `<YOUR-CLIENT-SECRET>` with your API Secret in the command above and execute it.


#### Handling the response

Expand Down Expand Up @@ -117,4 +119,4 @@ For the `post` endpoints:

```php
$amadeus->getClient()->postWithStringBody("/v1/shopping/availability/flight-availabilities", $body);
```
```
27 changes: 16 additions & 11 deletions docs/developer-tools/python.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ This tutorial will guide you through the process of creating a simple Python app
from amadeus import Client, Location, ResponseError

amadeus = Client(
client_id='AMADEUS_CLIENT_ID',
client_secret='AMADEUS_CLIENT_SECRET'
client_id='<YOUR-CLIENT-ID>',
client_secret='<YOUR-CLIENT-SECRET>'
)

try:
Expand All @@ -70,6 +70,7 @@ try:
except ResponseError as error:
print(error)
```
Replace `<YOUR-CLIENT-ID>` with your API Key and `<YOUR-CLIENT-SECRET>` with your API Secret in the command above.

- Once you import the amadeus library, you initialize the client by adding your credentials in the `builder` method. The library can also be initialized without any parameters when the environment variables `AMADEUS_CLIENT_ID` and `AMADEUS_CLIENT_SECRET` are present.
- The authentication process is handled by the SDK and the access token is renewed every 30 minutes.
Expand Down Expand Up @@ -141,7 +142,7 @@ To follow along with the tutorial you will need the followings:

`aiohttp` is a Python library for making asynchronous HTTP requests build top of `asyncio`. The library provides a simple way of making HTTP requests and handling the responses in a non-blocking way.

In the example below you can call the the Amadeus Flight-Checkin link API using the `aiohttp` library and the code runs in an async way.
In the example below you can call the the [Amadeus Flight-Checkin link API](https://developers.amadeus.com/self-service/category/flights/api-doc/flight-check-in-links) using the `aiohttp` library and the code runs in an async way.

```python
import aiohttp
Expand All @@ -151,8 +152,8 @@ import requests
AUTH_ENDPOINT = "https://test.api.amadeus.com/v1/security/oauth2/token"
headers = {"Content-Type": "application/x-www-form-urlencoded"}
data = {"grant_type": "client_credentials",
"client_id": 'YOUR_AMADEUS_API_KEY',
"client_secret": 'YOUR_AMADEUS_API_SECRET'}
"client_id": '<YOUR-CLIENT-ID>',
"client_secret": '<YOUR-CLIENT-SECRET>'}
response = requests.post(AUTH_ENDPOINT,
headers=headers,
data=data)
Expand All @@ -174,6 +175,7 @@ async def main():

asyncio.run(main())
```
Replace `<YOUR-CLIENT-ID>` with your API Key and `<YOUR-CLIENT-SECRET>` with your API Secret in the command above.

The above code makes `POST` request to the Authentication API using the `requests` library. The returned access token is then used in the headers of following requests to make 20 asyncronous API calls.

Expand All @@ -187,8 +189,8 @@ import requests
from amadeus import Client

amadeus = Client(
client_id='YOUR_AMADEUS_API_KEY',
client_secret='YOUR_AMADEUS_API_SECRET'
client_id='<YOUR-CLIENT-ID>',
client_secret='<YOUR-CLIENT-SECRET>'
)

async def main():
Expand All @@ -208,6 +210,7 @@ async def main():

asyncio.run(main())
```
Replace `<YOUR-CLIENT-ID>` with your API Key and `<YOUR-CLIENT-SECRET>` with your API Secret in the command above.

## OpenAPI Generator

Expand Down Expand Up @@ -249,23 +252,24 @@ with openapi_client.ApiClient(auth_configuration) as api_client:

body = dict(
grant_type="client_credentials",
client_id="YOUR_API_KEY",
client_secret="YOUR_API_SECRET",
client_id="<YOUR-CLIENT-ID>",
client_secret="<YOUR-CLIENT-SECRET>",
)
api_response = api_instance.oauth2_token(
body=body,
)

print(api_response.body['access_token'])
```
Replace `<YOUR-CLIENT-ID>` with your API Key and `<YOUR-CLIENT-SECRET>` with your API Secret in the command above.

The code uses the library we have generated to get an OAuth2 access token. With the `o_auth2_access_token_api.OAuth2AccessTokenApi()` we are able to call the `oauth2_token()` method.

The body of the request is being created by passing the `grant_type`, `client_id` and `client_secret` to the `oauth2_token()` method. If you want to know more about how to get the access token check the [authorization guide](../API-Keys/authorization.md).

### Call the Flight Offers Search API

Now let's call the Flight Offers Search API. Since thr OpenAPI Generator works with OAS3 you will have to convert the flight search specification to version 3 using the swagger editor (https://editor.swagger.io/){:target="\_blank"}. To do the convertion, navigate to the top menu and select `Edit` then `Convert to OAS 3`.
Now let's call the Flight Offers Search API. Since the OpenAPI Generator works with OAS3 you will have to convert the flight search specification to version 3 using the [swagger editor](https://editor.swagger.io/){:target="\_blank"}. To do the conversion, navigate to the top menu and select `Edit` then `Convert to OAS 3`.

The process is the same as above. You need to generate the library:

Expand All @@ -291,7 +295,7 @@ from openapi_client.apis.tags import shopping_api

flight_configuration = openapi_client.Configuration()
api_client = openapi_client.ApiClient(flight_configuration)
api_client.default_headers['Authorization'] = 'Bearer YOUR_ACCESS_TOKEN'
api_client.default_headers['Authorization'] = 'Bearer <YOUR-BEARER-TOKEN>'

api_instance = shopping_api.ShoppingApi(api_client)

Expand All @@ -310,6 +314,7 @@ try:
except openapi_client.ApiException as e:
print("Exception: %s\n" % e)
```
Replace `<YOUR-BEARER-TOKEN>` with the token you received from the authorization call.

The above code uses the generated library to to search for flight offers. It creates an instance of the `shopping_api.ShoppingApi` class and setting the default headers to include the access token.

Expand Down
Loading