Skip to content

Commit 51d2325

Browse files
authored
Merge pull request #17 from amadeus4dev/doc_update_25oct2018
Update authentication doc and examples
2 parents 9ee5493 + 433934b commit 51d2325

File tree

1 file changed

+57
-61
lines changed

1 file changed

+57
-61
lines changed

README.md

Lines changed: 57 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,14 @@ application](https://developers.amadeus.com/my-apps).
3131
var Amadeus = require('amadeus');
3232

3333
var amadeus = new Amadeus({
34-
clientId: '[YOUR_CLIENT_ID]',
35-
clientSecret: '[YOUR_CLIENT_SECRET]'
34+
clientId: 'REPLACE_BY_YOUR_API_KEY',
35+
clientSecret: 'REPLACE_BY_YOUR_API_SECRET'
3636
});
3737

3838
amadeus.referenceData.urls.checkinLinks.get({
39-
airline: '1X'
39+
airline: 'BA'
4040
}).then(function(response){
4141
console.log(response.data[0].href);
42-
//=> https://www.onex.com/manage/check-in
4342
}).catch(function(responseError){
4443
console.log(responseError.code);
4544
});
@@ -52,8 +51,8 @@ The client can be initialized directly.
5251
```js
5352
// Initialize using parameters
5453
var amadeus = new Amadeus({
55-
clientId: '...',
56-
clientSecret: '...'
54+
clientId: 'REPLACE_BY_YOUR_API_KEY',
55+
clientSecret: 'REPLACE_BY_YOUR_API_SECRET'
5756
});
5857
```
5958

@@ -95,10 +94,10 @@ in-depth information about every SDK method, it's arguments and return types.
9594

9695
This library conveniently maps every API path to a similar path.
9796

98-
For example, `GET /v2/reference-data/urls/checkin-links?airline=1X` would be:
97+
For example, `GET /v2/reference-data/urls/checkin-links?airline=BA` would be:
9998

10099
```js
101-
amadeus.referenceData.urls.checkinLinks.get({ airline: '1X' });
100+
amadeus.referenceData.urls.checkinLinks.get({ airline: 'BA' });
102101
```
103102

104103
Similarly, to select a resource by ID, you can pass in the ID to the **singular** path.
@@ -112,7 +111,7 @@ amadeus.shopping.hotel(123).offer(234).get(...);
112111
You can make any arbitrary API call as well directly with the `.client.get` method:
113112

114113
```js
115-
amadeus.client.get('/v2/reference-data/urls/checkin-links', { airline: '1X' });
114+
amadeus.client.get('/v2/reference-data/urls/checkin-links', { airline: 'BA' });
116115
```
117116

118117
## Promises
@@ -128,7 +127,7 @@ containing the (parsed or unparsed) response, the request, and an error code.
128127

129128
```js
130129
amadeus.referenceData.urls.checkinLinks.get({
131-
airline: '1X'
130+
airline: 'BA'
132131
}).then(function(response){
133132
console.log(response.body); //=> The raw body
134133
console.log(response.result); //=> The fully parsed result
@@ -152,8 +151,8 @@ amadeus.referenceData.locations.get({
152151
}).then(function(response){
153152
console.log(response.data); // first page
154153
return amadeus.next(response);
155-
}).then(function(nextReponse){
156-
console.log(nextReponse.data); // second page
154+
}).then(function(nextResponse){
155+
console.log(nextResponse.data); // second page
157156
});
158157
```
159158

@@ -165,8 +164,8 @@ The SDK makes it easy to add your own logger compatible with the default `consol
165164

166165
```js
167166
var amadeus = new Amadeus({
168-
clientId: '...',
169-
clientSecret: '...',
167+
clientId: 'REPLACE_BY_YOUR_API_KEY',
168+
clientSecret: 'REPLACE_BY_YOUR_API_SECRET',
170169
logger: new MyConsole()
171170
});
172171
```
@@ -178,97 +177,94 @@ variable. The available options are `silent` (default), `warn`, and `debug`.
178177

179178
```js
180179
var amadeus = new Amadeus({
181-
clientId: '...',
182-
clientSecret: '...',
180+
clientId: 'REPLACE_BY_YOUR_API_KEY',
181+
clientSecret: 'REPLACE_BY_YOUR_API_SECRET',
183182
logLevel: 'debug'
184183
});
185184
```
186185

187186
## List of supported endpoints
188187

189188
```js
190-
// Airpot and City Search
191-
// Find all the cities and airportes starting by 'LON'
192-
amadeus.referenceData.locations.get({
193-
keyword : 'LON',
194-
subType : Amadeus.location.any
195-
})
196-
197-
// Get a specific city or airport based on its id
198-
amadeus.referenceData.location('ALHR').get()
199-
200-
// Aiport Nearest Relevant Airport
201-
amadeus.referenceData.locations.airports.get({
202-
longitude : 49.000,
203-
latitude : 2.55
189+
// Flight Inspiration Search
190+
amadeus.shopping.flightDestinations.get({
191+
origin : 'MAD'
204192
})
205193

206194
// Flight Cheapest Date Search
207195
amadeus.shopping.flightDates.get({
208-
origin : 'NYC',
209-
destination : 'MAD'
196+
origin : 'NYC',
197+
destination : 'MAD'
198+
})
199+
200+
// Flight Low-fare Search
201+
amadeus.shopping.flightOffers.get({
202+
origin : 'NYC',
203+
destination : 'MAD',
204+
departureDate : '2019-08-01'
210205
})
211206

212207
// Flight Checkin Links
213208
amadeus.referenceData.urls.checkinLinks.get({
214-
airline : 'LH'
209+
airline : 'BA'
215210
})
216211

217212
// Airline Code Lookup
218213
amadeus.referenceData.airlines.get({
219-
IATACode : 'LH'
214+
IATACode : 'U2'
220215
})
221216

222-
// Flight Inspiration Search
223-
amadeus.shopping.flightDestinations.get({
224-
origin : 'MAD'
217+
// Airports and City Search (autocomplete)
218+
// Find all the cities and airports starting by 'LON'
219+
amadeus.referenceData.locations.get({
220+
keyword : 'LON',
221+
subType : Amadeus.location.any
225222
})
226223

227-
// Flight Low-fare Search
228-
amadeus.shopping.flightOffers.get({
229-
origin : 'NYC',
230-
destination : 'MAD',
231-
departureDate : '2019-08-01'
224+
// Get a specific city or airport based on its id
225+
amadeus.referenceData.location('ALHR').get()
226+
227+
// Airport Nearest Relevant Airport
228+
amadeus.referenceData.locations.airports.get({
229+
longitude : 49.000,
230+
latitude : 2.55
232231
})
233232

234233
// Flight Most Searched Destinations
235234
amadeus.travel.analytics.fareSearches.get({
236-
origin : 'NCE',
237-
sourceCountry : 'FR',
238-
period : '2017-08'
239-
})
240-
241-
// Flight Most Traveled Destinations
242-
amadeus.travel.analytics.airTraffic.traveled.get({
243-
origin : 'NCE',
235+
origin : 'MAD',
236+
sourceCountry : 'SP',
244237
period : '2017-08'
245238
})
246239

247240
// Flight Most Booked Destinations
248241
amadeus.travel.analytics.airTraffic.booked.get({
249-
origin : 'LON',
250-
period : '2016-05'
242+
origin : 'MAD',
243+
period : '2017-08'
244+
})
245+
246+
// Flight Most Traveled Destinations
247+
amadeus.travel.analytics.airTraffic.traveled.get({
248+
origin : 'MAD',
249+
period : '2017-01'
251250
})
252251

253252
// Flight Busiest Traveling Period
254253
amadeus.travel.analytics.airTraffic.busiestPeriod.get({
255-
cityCode: 'PAR',
254+
cityCode: 'MAD',
256255
period: '2017',
257256
direction: Amadeus.direction.arriving
258257
})
259258

260259
// Hotel Search API
261-
262-
// List of Hotels by City Code
260+
// Get list of hotels by city code
263261
amadeus.shopping.hotelOffers.get({
264-
cityCode : 'PAR'
262+
cityCode : 'MAD'
265263
})
266-
267-
// Get list of offers for a specific Hotel
264+
// Get list of offers for a specific hotel
268265
amadeus.shopping.hotel('SMPARCOL').hotelOffers.get()
269-
270-
// Confirm the availability of a specific offer for a specific Hotel
271-
amadeus.shopping.hotel('SMPARCOL').offer('4BA070BA10485322FA2C7E78C7852E').get()
266+
// Confirm the availability of a specific offer for a specific hotel
267+
amadeus.shopping.hotel('SMPARCOL').offer('4BA070CE929E135B3268A9F2D0C51E9D4A6CF318BA10485322FA2C7E78C7852E').get()
272268
```
273269

274270
## Development & Contributing

0 commit comments

Comments
 (0)