@@ -204,7 +204,7 @@ amadeus.shopping.flightOffersSearch.get({
204204
205205// Flight Offers Search POST
206206// A full example can be found at https://github.com/amadeus4dev/amadeus-code-examples
207- amadeus .shopping .flightOffersSearch .post (JSON . stringify ( body) )
207+ amadeus .shopping .flightOffersSearch .post (body)
208208
209209// Flight Offers Price
210210amadeus .shopping .flightOffersSearch .get ({
@@ -214,12 +214,12 @@ amadeus.shopping.flightOffersSearch.get({
214214 adults: ' 1'
215215}).then (function (response ){
216216 return amadeus .shopping .flightOffers .pricing .post (
217- JSON . stringify ( {
217+ {
218218 ' data' : {
219219 ' type' : ' flight-offers-pricing' ,
220220 ' flightOffers' : [response .data [0 ]]
221221 }
222- })
222+ }
223223 )
224224}).then (function (response ){
225225 console .log (response .data );
@@ -229,19 +229,19 @@ amadeus.shopping.flightOffersSearch.get({
229229
230230// Flight Offers Price with additional parameters
231231// for example: check additional baggage options
232- amadeus .shopping .flightOffers .pricing .post (JSON . stringify ( body) ,{include: ' bags' })
232+ amadeus .shopping .flightOffers .pricing .post (body ,{include: ' bags' });
233233
234234// Flight Create Orders
235235// To book the flight-offer(s) returned by the Flight Offers Price
236236// and create a flight-order with travelers' information.
237237// A full example can be found at https://git.io/JtnYo
238238amadeus .booking .flightOrders .post (
239- JSON . stringify ( {
239+ {
240240 ' type' : ' flight-order' ,
241241 ' flightOffers' : [priced- offers],
242242 ' travelers' : []
243- })
244- )
243+ }
244+ );
245245
246246// Retrieve flight order with ID 'XXX'. This ID comes from the
247247// Flight Create Orders API, which is a temporary ID in test environment.
@@ -261,9 +261,9 @@ amadeus.shopping.flightOffersSearch.get({
261261 adults: ' 1'
262262}).then (function (response ){
263263 return amadeus .shopping .seatmaps .post (
264- JSON . stringify ( {
264+ {
265265 ' data' : [response .data [0 ]]
266- })
266+ }
267267 );
268268}).then (function (response ){
269269 console .log (response .data );
@@ -276,10 +276,10 @@ amadeus.shopping.seatmaps.get({
276276});
277277
278278// Flight Availabilities Search
279- amadeus .shopping .availability .flightAvailabilities .post (JSON . stringify (( body) );
279+ amadeus .shopping .availability .flightAvailabilities .post (body);
280280
281281// Branded Fares Upsell
282- amadeus .shopping .flightOffers .upselling .post (JSON . stringify ( body) );
282+ amadeus .shopping .flightOffers .upselling .post (body);
283283
284284// Flight Choice Prediction
285285amadeus .shopping .flightOffersSearch .get ({
@@ -288,9 +288,7 @@ amadeus.shopping.flightOffersSearch.get({
288288 departureDate: ' 2022-11-01' ,
289289 adults: ' 2'
290290}).then (function (response ){
291- return amadeus .shopping .flightOffers .prediction .post (
292- JSON .stringify (response)
293- );
291+ return amadeus .shopping .flightOffers .prediction .post (response);
294292}).then (function (response ){
295293 console .log (response .data );
296294}).catch (function (responseError ){
@@ -346,24 +344,24 @@ amadeus.travel.analytics.airTraffic.busiestPeriod.get({
346344// parse information from flight, hotel, rail, and rental car confirmation emails
347345// Parse directly from your confirmation file by using helper `fromFile`
348346amadeus .travel .tripParser .post (
349- JSON . stringify ( {
347+ {
350348 ' payload' : amadeus .travel .tripParser .fromFile (fs .readFileSync (' confirmation.eml' )),
351349 " metadata" : {
352350 " documentType" : " eml" ,
353351 " name" : " BOOKING_DOCUMENT" ,
354352 " encoding" : " BASE_64"
355353 }
356- }))
354+ })
357355// Alternatively Parse from a string encoded in BASE_64
358356amadeus .travel .tripParser .post (
359- JSON . stringify ( {
357+ {
360358 ' payload' : " STRING in BASE_64"
361359 " metadata" : {
362360 " documentType" : " html" ,
363361 " name" : " BOOKING_DOCUMENT" ,
364362 " encoding" : " BASE_64"
365363 }
366- }))
364+ })
367365
368366// City Search API
369367// finds cities that match a specific word or string of letters.
@@ -407,26 +405,28 @@ amadeus.shopping.hotelOfferSearch('XXX').get()
407405
408406// Hotel Booking API v2
409407amadeus .booking .hotelOrders .post (
410- JSON . stringfy ( {
408+ {
411409 ' data' : {
412410 ' type' : ' hotel-order' ,
413411 ' guests' : [],
414412 ' travelAgent' : {},
415413 ' roomAssociations' : [],
416414 ' payment' : {}
417- }})
415+ }
416+ }
418417)
419418
420419
421420// Hotel Booking API v1
422421amadeus .booking .hotelBookings .post (
423- JSON . stringify ( {
422+ {
424423 ' data' : {
425424 ' offerId' : ' XXXX' ,
426425 ' guests' : [],
427426 ' payments' : [],
428427 ' rooms' : []
429- }})
428+ }
429+ }
430430)
431431
432432// On-Demand Flight Status
@@ -533,13 +533,13 @@ amadeus.analytics.itineraryPriceMetrics.get({
533533
534534// Cars & Transfers APIs
535535// Transfer Search API: Search Transfer
536- amadeus .shopping .transferOffers .post (JSON . stringify ( body) );
536+ amadeus .shopping .transferOffers .post (body);
537537
538538// Transfer Book API: Book a transfer based on the offer id
539- amadeus .ordering .transferOrders .post (JSON . stringify ( body), offerId= ' 2094123123' );
539+ amadeus .ordering .transferOrders .post (body, offerId= ' 2094123123' );
540540
541541// Transfer Management API: Cancel a transfer based on the order id & confirmation number
542- amadeus .ordering .transferOrder (' XXX' ).transfers .cancellation .post (JSON . stringify ({}) , confirmNbr= ' 12345' );
542+ amadeus .ordering .transferOrder (' XXX' ).transfers .cancellation .post ({} , confirmNbr= ' 12345' );
543543
544544` ` `
545545
0 commit comments