amadeus4dev / amadeus-node Goto Github PK
View Code? Open in Web Editor NEWNode library for the Amadeus Self-Service travel APIs
Home Page: https://developers.amadeus.com
License: MIT License
Node library for the Amadeus Self-Service travel APIs
Home Page: https://developers.amadeus.com
License: MIT License
When the environmental variables AMADEUS_CLIENT_ID and AMADEUS_CLIENT_SECRET are present, the client fails to be initialized without any parameters and throws an authentication error ArgumentError: Missing required argument: clientId
var Amadeus = require('amadeus');
var amadeus = new Amadeus();
amadeus.shopping.flightOffersSearch.get({
originLocationCode: 'SYD',
destinationLocationCode: 'BKK',
departureDate: '2021-11-01',
adults: '2'
}).then(function(response){
console.log(response.data);
}).catch(function(responseError){
console.log(responseError.code);
});
I think the title is clear enough but just in case.
When I do a Flight Offers request
amadeus.client.get('/v2/shopping/flight-offers', params)
The rates on the response are not the ones I get from other GDS on a local search (Argentina)
Is there a way to change the market for which the requests are made? Because the price difference is quite high in some cases, and when I check the fare details the itinerary might be the same but the fare code is different
From what I’ve checked prices correspond more to a Spain search/market (if I do a conversion and compare), but still not sure.
I am building a mobile app with React Native (Expo), after installing the Node SDK I discovered that I need to install some other dependencies probably because the SDK was written specifically for web apps.
Expected Behavior: The app should start without any errors.
Actual Behavior: It returns the following errors:
Stable Behavior? [What percentage of the time does it reproduce?]
Node/NPM Version: 12.18.1 / 6.14.5
Expo CLI Version: 3.21.13
If you want to switch to another Amadeus account, you change the credentials but instead of requesting a new token, it seems like the old token is used from the first Amadeus account. How is it possible to ignore the old token In order to get a correct token for the new Amadeus account?
Expected Behavior: I would expect the package to request a new token since it is a new Amadeus account
Actual Behavior: It seems like the old existing token from the first Amadeus account is used which produces the error Invalid token
Stable Behavior? 100%
Node: v14.8.0
npm: 6.14.15
OS: macOS Big Sur
Please make sure you checked the following:
This package is missing TypeScript Types defination
I'm implementing Amadeus with AngularJS. I used the amadeus-node
as a reference, especially regarding the token expiration-refreshing flow.
After I read the code I pointed out there might be an issue with the token handling here:
this.expiresAt = Date.now() + response.result['expires_in'];
expires_in
is the lifetime in seconds of the access token.Date.now()
method returns the number of milliseconds elapsed since January 1, 1970.No need to reproduce
Expected Behavior:
Correct expiration time:
this.expiresAt = Date.now() + (response.result['expires_in']*1000);
Actual Behavior:
this.expiresAt = Date.now() + response.result['expires_in'];
returns wrong expiration time due to the mixed format (ms + s).
Stable Behavior? [What percentage of the time does it reproduce?]
[What version of Node/NPM are you running? What Operating System are you on?]
Please make sure you checked the following:
I gett the error "Module not found: Error: Can't resolve 'http'" while building an angular project with amadeus-node.
Expected Behavior: The app starts in my default browser.
Actual Behavior: Errors in the terminal at the end of the build:
ERROR in ./node_modules/amadeus/lib/amadeus/client/validator.js
Module not found: Error: Can't resolve 'http' in 'd:\workspace\my-app-name\node_modules\amadeus\lib\amadeus\client'
As soon as I remove the Instance of class Amadeus everything is fine.
Stable Behavior? 100%
Windows 10 Home x64: 10.0.18362 Build 18362
Visual Studio Code: 1.48.1
Node.js: 12.18.3
Angular CLI: 10.0.6
NPM: 6.14.6
amadeus-node: 5.2.0
No, I'm not running node 6 and yes, I've downloaded the newest version of this library (as you can see above).
As far as I can see, all necessary files of the package are where they should be.
Two unexpected / unnecessary warnings in the handling of promises (looks like related to a network error):
bluebird.js?f684:1564 Warning: a promise was rejected with a non-error: [object Object] at EventEmitter.eval (webpack-internal:///./node_modules/amadeus/lib/amadeus/client.js:253:18) at EventEmitter.emit (webpack-internal:///./node_modules/node-libs-browser/node_modules/events/events.js:146:5) at Listener.eval (webpack-internal:///./node_modules/amadeus/lib/amadeus/client/listener.js:183:24) at exports.IncomingMessage.emit (webpack-internal:///./node_modules/node-libs-browser/node_modules/events/events.js:146:5) at eval (webpack-internal:///./node_modules/stream-http/lib/response.js:27:9) at Item.run (webpack-internal:///./node_modules/process/browser.js:153:14) at drainQueue (webpack-internal:///./node_modules/process/browser.js:123:42)
printWarning @ bluebird.js?f684:1564
formatAndLogError @ bluebird.js?f684:1280
warn @ bluebird.js?f684:1175
Promise._warn @ bluebird.js?f684:771
Promise._rejectCallback @ bluebird.js?f684:3256
(anonymous) @ bluebird.js?f684:3271
(anonymous) @ client.js?9cbe:253
emit @ events.js?7e25:146
(anonymous) @ listener.js?2211:183
emit @ events.js?7e25:146
(anonymous) @ response.js?c90b:27
Item.run @ browser.js?f28c:153
drainQueue @ browser.js?f28c:123
setTimeout (async)
runTimeout @ browser.js?f28c:41
process.nextTick @ browser.js?f28c:143
nextTick @ index.js?966d:26
resume @ _stream_readable.js?8b77:783
Readable.resume @ _stream_readable.js?8b77:775
Readable.on @ _stream_readable.js?8b77:745
onResponse @ listener.js?2211:60
emit @ events.js?7e25:146
ClientRequest._connect @ request.js?925e:268
(anonymous) @ request.js?925e:159
Promise.then (async)
ClientRequest._onFinish @ request.js?925e:157
(anonymous) @ request.js?925e:62
emit @ events.js?7e25:146
finishMaybe @ _stream_writable.js?5bc2:630
afterWrite @ _stream_writable.js?5bc2:492
afterTick @ index.js?966d:40
Item.run @ browser.js?f28c:153
drainQueue @ browser.js?f28c:123
setTimeout (async)
runTimeout @ browser.js?f28c:41
process.nextTick @ browser.js?f28c:143
nextTick @ index.js?966d:39
onwrite @ _stream_writable.js?5bc2:480
WritableState.onwrite @ _stream_writable.js?5bc2:180
ClientRequest._write @ request.js?925e:275
doWrite @ _stream_writable.js?5bc2:428
writeOrBuffer @ _stream_writable.js?5bc2:417
Writable.write @ _stream_writable.js?5bc2:334
execute @ client.js?9cbe:203
unauthenticatedRequest @ client.js?9cbe:184
loadAccessToken @ access_token.js?50dc:134
emitOrLoadAccessToken @ access_token.js?50dc:96
bearerToken @ access_token.js?50dc:56
request @ client.js?9cbe:150
get @ client.js?9cbe:106
get @ locations.js?d315:69
getAirports @ TravelData.js?c2e7:31
AirportSelector._this.populateAirports @ AirportSelector.js?4781:41
(anonymous) @ AirportSelector.js?4781:29
setTimeout (async)
AirportSelector._this.mouseDown @ AirportSelector.js?4781:28
handleChange @ Autocomplete.js?ffc0:128
callCallback @ react-dom.development.js?61bb:149
invokeGuardedCallbackDev @ react-dom.development.js?61bb:199
invokeGuardedCallback @ react-dom.development.js?61bb:256
invokeGuardedCallbackAndCatchFirstError @ react-dom.development.js?61bb:270
executeDispatch @ react-dom.development.js?61bb:561
executeDispatchesInOrder @ react-dom.development.js?61bb:583
executeDispatchesAndRelease @ react-dom.development.js?61bb:680
executeDispatchesAndReleaseTopLevel @ react-dom.development.js?61bb:688
forEachAccumulated @ react-dom.development.js?61bb:660
runEventsInBatch @ react-dom.development.js?61bb:816
runExtractedEventsInBatch @ react-dom.development.js?61bb:824
handleTopLevel @ react-dom.development.js?61bb:4826
batchedUpdates$1 @ react-dom.development.js?61bb:20233
batchedUpdates @ react-dom.development.js?61bb:2151
dispatchEvent @ react-dom.development.js?61bb:4905
(anonymous) @ react-dom.development.js?61bb:20284
unstable_runWithPriority @ scheduler.development.js?3069:255
interactiveUpdates$1 @ react-dom.development.js?61bb:20283
interactiveUpdates @ react-dom.development.js?61bb:2170
dispatchInteractiveEvent @ react-dom.development.js?61bb:4882
class TravelData {
constructor() {
const client = new Amadeus({
clientId: config.amadeus.key,
clientSecret: config.amadeus.secret
});
this.client = client;
}
getAirports(prefix) {
return this.client.referenceData.locations.get({
keyword: prefix,
subType: Amadeus.location.airport
}).then(resp => {
// console.log(resp);
return resp.data;
}).catch(console.log)
}
}
new TravelData().getAirports('aus');
Expected Behavior: Success with no warnings
Actual Behavior: Warnings
Stable Behavior? 100%
73.0.3683.103
3.1.0
v11.14.0
4.29.5
Please make sure you checked the following:
add support for Hotel Name Autocomplete API
The Travel/Most Searched API has been decommissioned but not removed from the SDK
Example here
How to connect behind proxy server to Amadeus APIs? I am not able to find the documentation around this.
Expected Behavior: Output should be coming as expected for the API
Actual Behavior: Network error is returned
Node 14
The goal of this document is to set a shared standard for implementation and development of all Amadeus SDKs. For the sake of this document, there is no differentiation between SDKs and API client SDKs.
This document is a work in progress, and should be changed and updated as changes are made to the APIs or developer needs are discovered.
The following document follows the MoSCoW method of prioritising rules. Please follow the following guidelines when evaluating rules.
MUST
- Rules labeled as must are requirements that should not be deviated from at any costSHOULD
- Rules labeled as should are requirements that could be deviated from if needed, though this will have to be documented and cleared with all stakeholders before it can be disregarded.COULD
- Rules labeled as could are requirements that are desirable but not necessary and therefore would be nice to have where time and resources permit.We do not use the fourth won't
level in this specification.
Currently this specification is limited due to various reasons. This means that currently:
master
branchmaster
branch should be kept in a condition that allows for direct use through checkoutCHANGELOG
file must to be updated with the Major
, Minor
and Patch
changesREADME
fileLICENSE
fileCHANGELOG
fileamadeus
, Amadeus
, or amadeus/amadeus
.amadeus-sdk
, AmadeusSDK
, or amadeusdev/amadeus
.amadeus-php
) or a reference to this being an SDK client library (e.g. not amadeus-sdk
)amadeus
, Amadeus
, or amadeus/amadeus
.1.0.0
README
file
README
file should include a version badgeREADME
file should include a test status badgeREADME
file must link to the LICENSE
fileREADME
file should be written in MarkdownREADME
file must have instructions on how to install the SDK using a package managerREADME
file could have instructions on how to install the SDK from version controlREADME
file must have instructions on how to initialise the SDK with the API credentials
amadeus
. For example, amadeus = new Amadeus::Client()
README
file should document all the different ways the SDK can be initializedREADME
file must include a basic sample on how to make a first API callREADME
file must link to the developer portalREADME
file should link to documentation on the developer portalREADME
file must document any installation requirements and prerequisitesREADME
file should to official support channelsREADME
file must document where a developer can find their API credentialsamadeus
, travel
, flights
, hotels
, sdk
, library
CHANGELOG
fileCODE_OF_CONDUCT
fileCONTRIBUTING
file
ISSUE_TEMPLATE
filePULL_REQUEST_TEMPLATE
fileSUPPORT
fileTemplates for a lot of these files have been provided in the templates folder
library_name/library_version language_name/language_version
amadeus-ruby/1.0.0 ruby/2.4.2
library_name/library_version language_name/language_version app_name/app_version
amadeus-ruby/1.0.0 ruby/2.4.2 test_ios_app/1.0.0
amadeus
, com.amadeus.developer
, or Amadeus
package nameAmadeus::Client
in Ruby, or Amadeus\Client
in PHPAMADEUS_CLIENT_ID
and AMADEUS_CLIENT_SECRET
AMADEUS_DEBUG
test
and production
)GET /v1/flights
: amadeus.flights.get
GET /v2/hotels/offers
: amadeus.hotels.offers.get
GET /v1/hotels/123
: amadeus.hotels(123)
GET /v1/hotels/123
: amadeus.hotels.get(123)
GET /v1/hotels/123
: amadeus.hotels.get(id: 123)
GET /v1/hotels/123/hotel-offers
: amadeus.hotels(123).offers
GET /v1/hotels/123/hotel-offers
: amadeus.hotels.get(123).offers
GET /v1/hotels/123/hotel-offers
: amadeus.hotels.get(id: 123).offers
GET /v1/flights/123/legs
: amadeus.flights(123).legs()
(should make 1 API call only)GET /v1/flights/123/legs/345
: amadeus.flights(123).legs(345)
(should make 1 API call only)reference-data
) to a more idiomatic format (e.g. reference_data
or ReferenceData
)amadeus.flights().get()
: GET /v1/flights
amadeus.flights().get({ foo: 123 }
: GET /v1/flights?foo=123
amadeus.flights(123).get()
: GET /v1/flights/123
amadeus.flights().post({ from: "LHR", to: "LAX" })
amadeus.flights().get(params, callback_function)
amadeus.flights().get(params).then(...).catch(...)
ResponseError
for any request that did not result a HTTP 200 or 201 response codeNetworkError
when a transport error occurs (e.g. if the API could not be reached, or unexpected data was returned from the API)AuthenticationError
when incorrect credentials were providedNotFoundError
when the API call returned a 404ClientError
when a generic client error occurs (e.g. incorrect data was sent to the API, basically any 4XXX error)ServerError
if the API returned a 5XX error]ParserError
if the response was JSON but could not be parsedcode
attribute containing the name of the error, e.g. NetworkError
.description
attribute containing the parsed JSON from the API, if the API errored and contained JSON.reference-data
namespace
GET /v2/reference_data/urls/checkin-links
endpoint
amadeus.reference_data.urls.checkin_links.get({ airline: 'BA' })
GET /v2/reference_data/locations
endpoint
amadeus.reference_data.locations.get({ keyword: 'LON' })
GET /v2/reference_data/locations/airports
endpoint
amadeus.reference_data.locations.airports.get({ latitude: '0.0', longitude: '0.0' })
shopping
namespace
GET /v1/shopping/flight-destinations
endpoint
amadeus.shopping.flight_destinations.get({ origin: 'LAX' })
GET /v1/shopping/flight-offers
endpoint
amadeus.shopping.flight_offers.get({ origin: 'LAX', destination: 'LHR', departureDate: '2020-12-01' })
GET /v1/shopping/flight-dates
endpoint
amadeus.shopping.flight_dates.get({ origin: 'LAX', destination: 'LHR' })
travel/analytics
namespace
GET /v1/travel/analytics/fare-searches
endpoint
amadeus.travel.analytics.fare_searches.get({ origin: 'LAX', sourceCountry: 'US', period: 2015 })
GET /v1/travel/analytics/air-traffics
endpoint
amadeus.travel.analytics.air_traffics.get({ origin: 'LAX', period: '2015-07' })
shopping/hotels
namespace
GET /v1/shopping/hotel-offers
endpoint
amadeus.shopping.hotel_offers.get({ cityCode: 'LAX' }
GET /v1/shopping/hotels/:hotel_id/hotel-offers
endpoint
amadeus.shopping.hotels.get(123).hotel_offers.get({ checkInDate: '2018-12-01', checkOutDate: '2018-12-03' })
GET /v1/shopping/hotels/:hotel_id/offers/:offer_id
endpoint
amadeus.shopping.hotels.get(123).hotel_offers.get(345)
result
attribute with the parsed JSON content if the content could be parseddata
attribute with the content from the data key from the result
hash, if it is presentstatusCode
attribute with HTTP status code of the responserequest
attribute with the details of the original request madeparsed
attribute which should be true
when the JSON was successfully parsed.next
, .first
, .last
, .previous
methods on the API client to find the relevant page for a response
let next_response = amadeus.next(response);
locations = amadeus.reference_data.locations.get(keyword: 'lon', subType: Amadeus::Location::Airport)
let locations = amadeus.referenceData.locations.get({ keyword: 'lon', subType: Amadeus.location.airport });
amadeus.foo.bar(origin: locations.data.first['iataCode'])
amadeus.foo.bar({ origin: locations.data.first.iataCode });
amadeus.get('/foo/bar')
W, [2018-02-19T16:06:29.881202 #67814] WARN -- Amadeus AuthenticationError: {
"error": "invalid_client",
"error_description": "Client credentials are invalid",
"code": 38187,
"title": "Invalid parameters"
}
amadeus.client.get('/foo/bar').then(...).catch(...);
Amadeus AuthenticationError { error: 'invalid_client',
error_description: 'Client credentials are invalid',
code: 38187,
title: 'Invalid parameters' }
amadeus.get('/foo/bar')
W, [2018-02-19T16:06:13.523516 #67786] WARN -- Amadeus NotFoundError: [
{
"code": 38196,
"title": "Resource not found",
"detail": "The targeted resource doesn't exist",
"status": 404
}
]
amadeus.client.get('/foo/bar').then(...).catch(...);
Amadeus NotFoundError [ { code: 38196,
title: 'Resource not found',
detail: 'The targeted resource doesn\'t exist',
status: 404 } ]
amadeus.reference_data.locations.get(
subType: Amadeus::Location::ANY
)
W, [2018-02-19T16:05:55.923870 #67772] WARN -- Amadeus ClientError: [
{
"status": 400,
"code": 32171,
"title": "MANDATORY DATA MISSING",
"detail": "Missing mandatory query parameter",
"source": {
"parameter": "keyword"
}
}
]
amadeus.referenceData.locations.get({
keyword: 'lon'
}).then(...).catch(...);
Amadeus ClientError [ { status: 400,
code: 32171,
title: 'MANDATORY DATA MISSING',
detail: 'Missing mandatory query parameter',
source: { parameter: 'subType' } } ]
amadeus.get('/something/that/errors/');
W, [2018-02-19T16:07:42.651272 #67846] WARN -- Amadeus ServerError: [
{
"code": 38189,
"title": "Internal error",
"detail": "An internal error occured, please contact your administrator",
"status": 500
}
]
amadeus.get('/something/that/errors/').then(...).catch(...);
Amadeus ServerError [ { code: 38189,
title: 'Internal error',
detail: 'An internal error occured, please contact your administrator',
status: 500 } ]
amadeus.get('/something/that/errors/');
W, [2018-02-19T16:13:14.374444 #68060] WARN -- Amadeus NetworkError: nil
amadeus.get('/something/that/errors/').then(...).catch(...);
Amadeus NetworkError null
amadeus.get('/something/that/rate/limits/');
W, [2018-02-19T16:07:42.651272 #67846] WARN -- Amadeus ServerError: [
{
code: 38194,
title: 'Too many requests',
detail: 'The network rate limit is exceeded, please try again later',
status: 429
}
]
amadeus.get('/something/that/errors/').then(...).catch(...);
Amadeus ClientError [ { code: 38194,
title: 'Too many requests',
detail: 'The network rate limit is exceeded, please try again later',
status: 429 } ]
async/await
Update the ruby SDK to support the new APIs
The retrieve endpoint is missing on the Points of Interest implementation:
Returns a single Point of Interest from a given id.
GET /reference-data/locations/pois/{poisId}
Hi there!
I'm sorry if it is not appropriate to ask questions here, but I consider to use this service in my project and would like to know if there are any list of fields which a required in any response?
So, for example for the city autocomplete request, can I trust that all fields of the object will be there or some of them might be absent (optional) or even all fields are optional?
AI-Generated Picture was decommissioned and should be removed from the SDK
I'm trying to use the flight offers upsell endpoint in order to get other fares (ex: not Basic Economy) for a flight. It seems to work fine with the exception that the upsell data is all in EUR when my initial data is in USD. I've tried adding currencyCode
to the request but that doesn't help.
It looked like this was the best way to get other fares for a flight, but please let me know if I missed something.
Here's the code snippet and the corresponding data:
const search = async () => {
const flightOffer = await amadeus.shopping.flightOffersSearch.get({
adults: 1,
currencyCode: 'USD',
includedAirlineCodes: 'AS',
departureDate: '2021-09-22',
destinationLocationCode: 'PHX',
originLocationCode: 'SFO',
nonStop: true,
});
const upsell = await amadeus.shopping.flightOffers.upselling.post(
JSON.stringify({
data: {
type: 'flight-offers-upselling',
flightOffers: [flightOffer.data[0]],
},
})
);
return upsell.data;
};
{
"type": "flight-offer",
"id": "1",
"source": "GDS",
"instantTicketingRequired": false,
"nonHomogeneous": false,
"paymentCardRequired": false,
"lastTicketingDate": "2021-07-30",
"itineraries": [
{
"segments": [
{
"departure": {
"iataCode": "SFO",
"terminal": "2",
"at": "2021-09-22T12:50:00"
},
"arrival": {
"iataCode": "PHX",
"terminal": "3",
"at": "2021-09-22T14:50:00"
},
"carrierCode": "AS",
"number": "2028",
"aircraft": { "code": "E75" },
"operating": { "carrierCode": "AS" },
"duration": "PT2H",
"id": "1",
"numberOfStops": 0
}
]
}
],
"price": {
"currency": "USD",
"total": "78.39",
"base": "59.53",
"fees": [
{ "amount": "0.00", "type": "SUPPLIER" },
{ "amount": "0.00", "type": "TICKETING" },
{ "amount": "0.00", "type": "FORM_OF_PAYMENT" }
],
"grandTotal": "78.39",
"billingCurrency": "USD"
},
"pricingOptions": {
"fareType": ["PUBLISHED"],
"includedCheckedBagsOnly": false
},
"validatingAirlineCodes": ["AS"],
"travelerPricings": [
{
"travelerId": "1",
"fareOption": "STANDARD",
"travelerType": "ADULT",
"price": {
"currency": "USD",
"total": "78.39",
"base": "59.53",
"taxes": [
{ "amount": "4.30", "code": "ZP" },
{ "amount": "5.60", "code": "AY" },
{ "amount": "4.46", "code": "US" },
{ "amount": "4.50", "code": "XF" }
],
"refundableTaxes": "5.60"
},
"fareDetailsBySegment": [
{
"segmentId": "1",
"cabin": "ECONOMY",
"fareBasis": "OH2OAVBN",
"brandedFare": "SV",
"class": "X",
"includedCheckedBags": { "quantity": 0 }
}
]
}
]
}
Expected Behavior: [What you expect to happen]
Currency to match the flight offer or to be able to specify
Actual Behavior: [What actually happens]
Currency is always in EUR
Stable Behavior? [What percentage of the time does it reproduce?]
100%
Node 14.1.0
Npm 6.14.4
Yarn 1.12.1
OS: Debian Buster
Please make sure you checked the following:
[x] Are you running any of the current Node LTS versions?
[x] Did you download the latest version of this library?
Working with the endpoints without knowing all possible parameters which include optional parameters makes it a lot more difficult to play around with the SDKs.
children: 2
and child: 2
before I was sure which was the right parameter.add support for HTTP override
const response = await amadeus.shopping.hotelOffers.get({citycode})
returns AuthorizationError, but access_token is valid.
other endpoints are working.
v14.16.1
When running my javascript code on Chrome and initialize amadeus, got the error:
Uncaught ReferenceError: require is not defined
I used "npm install amadeus --save"
and wrote the below function in javascript:
function fetchHotelInfo() {
let Amadeus = require('amadeus');
let amadeus = new Amadeus({
clientId: '',
clientSecret: ''
});
amadeus.referenceData.urls.checkinLinks.get({
airlineCode: 'BA'
}).then(function(response){
console.log(response.body); //=> The raw body
console.log(response.result); //=> The fully parsed result
console.log(response.data); //=> The data attribute taken from the result
}).catch(function(error){
console.log(error.response); //=> The response object with (un)parsed data
console.log(error.response.request); //=> The details of the request made
console.log(error.code); //=> A unique error code to identify the type of error
});
}
Expected Behavior: something should be logged
Actual Behavior: Uncaught ReferenceError: require is not defined
Stable Behavior? always
NPM: 6.14.4, MAC 10.15.4
Please make sure you checked the following:
In hotel-sentiments api throws error
'{"errors":[{"status":415,"code":477,"title":"INVALID FORMAT","detail":"Accept header value specified in the request is not supported"}]}'
i am using this syntax,
amadeus.client.get('/v2/e-reputation/hotel-sentiments',{hotelIds :"ADNYCCTB"});
The departureDate
in getting started code snippet is outdated and causes ClientError.
It would be nice if the date can be set to some future dates. :D
var Amadeus = require('amadeus');
var amadeus = new Amadeus({
clientId: 'REPLACE_BY_YOUR_API_KEY',
clientSecret: 'REPLACE_BY_YOUR_API_SECRET'
});
amadeus.shopping.flightOffersSearch.get({
originLocationCode: 'SYD',
destinationLocationCode: 'BKK',
departureDate: '2020-08-01',
adults: '2'
}).then(function(response){
console.log(response.data);
}).catch(function(responseError){
console.log(responseError.code);
});
Expected Behavior: Response.data
Actual Behavior: ClientError
The creation of a flight order expects a different payload than the one documented. (data
wrapper to the request object)
Expected Behavior: [What you expect to happen]
amadeus.booking.flightOrders.post(
JSON.stringify({
data: {
'type': 'flight-order',
'flightOffers': response.flightOffers,
'travelers_info': []
}
})
or handle the data
internally.
Actual Behavior: [What actually happens]
amadeus.booking.flightOrders.post(
JSON.stringify({
'type': 'flight-order',
'flightOffers': response.flightOffers,
'travelers_info': []
})
Results an error: MANDATORY DATA MISSING - data needed 400/32171
[What version of Node/NPM are you running? What Operating System are you on?]
v12.16.1
Please make sure you checked the following:
Let me know if I can help with a PR.
Thank you.
cbetta
github account by setting up an amadeus***
github account
Packaging broken; not installing the module?
$ npm install amadeus4dev/amadeus-node --save
npm WARN [email protected] No repository field.
$ ls -alt node_modules/amadeus/
total 72
drwxrwxr-x 2 hari hari 4096 May 14 22:54 .
drwxrwxr-x 15 hari hari 4096 May 14 22:54 ..
-rw-rw-r-- 1 hari hari 2309 May 14 22:54 package.json
-rw-rw-r-- 1 hari hari 791 Oct 26 1985 CHANGELOG.md
-rw-rw-r-- 1 hari hari 1085 Oct 26 1985 LICENSE
-rw-rw-r-- 1 hari hari 8027 Oct 26 1985 README.md
-rw-rw-r-- 1 hari hari 534 Oct 26 1985 .travis.yml
$ node amadeus_test.js
internal/modules/cjs/loader.js:573
throw err;
^
Error: Cannot find module 'amadeus'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:571:15)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.