/node-expedia-api

Small node.js wrapper built for the expedia EAN api

Primary LanguageJavaScript

NPM

This module is a fork of expedia module that is not maintained anymore.

Expedia API

Small client interface for the Expedia EAN api. Provides an interface for the following methods:

  • Hotel List Retrieve a list of hotels by location or a list of specific hotel ids
  • Hotel Information Retrieve detailed information about a hotel from a hotel id
  • Room Availability Retrieve all available rooms for a specific hotel that accommodate the provided guest count and any other criteria.
  • Room Images Retrieve a list of room images for a specific hotelId organized by room type
  • Payment Types Retrieve credit card types compatible with current request settings
  • Book Reservation Request a reservation for the specified room(s).
  • Itinerary Request Retrieve an existing itinerary's status and details, confirm the status of a previously requested booking, or retrieve a list of itineraries from a specified date span.
  • Cancel Reservation Cancel an existing reservation for a single room.
  • Ping Request Send a ping request to expedia API servers to determine if service is available in the event of a suspected outage or ISP issue, or to obtain EAN's Unix server time when troubleshooting issues with signature authentication.
  • Geo Functions Obtain location data such as a specific destinationId, latitude/longitude coordinates, and the number of active properties available within the location.

Installation

Install with npm:
npm install yfb-expedia

Initialization

Usage requires an Expedia Api key and CID. For development use you can use the CID 55505. You can obtain your api key from the Expedia EAN api documentation.

 var options = {
        cid     : "YOUR CID",
        apiKey  : "YOUR EAN API KEY",
        locale  : "en_US",  // optional defaults to en_US
        currencyCode :"USD"  // optional defaults to USD
    };

var expedia = require("expedia")(options, sendAsREST);

sendAsREST parameter allows you to choose if you want to send your data in XML or REST format (forgetting the param sets format to XML). Note that usage of XML is going to be deprecated by Expedia.

Usage

Expedia requires that you pass in a customer ip, unique session identifier, and browser agent. The remaining parameters are defined in the Expedia EAN api documentation. Please see the example directory for more options.

var options = {
  "customerSessionId" : "thisisauniqueID",
  "customerIpAddress" : "127.0.0.1",
  "customerUserAgent" : "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_4) AppleWebKit/537.36 (KHTML, like Gecko)",
  "LocationInfoRequest": {
    "locale": "en_US",
    "destinationString": "Seattle, WA"
  }
};

expedia.geoSearch(options, function(err, res){
    if(err)throw new Error(err);
    console.log(res);
});