How do I get the format I want in my responses?

Send the request with the proper content type and header to receive  the  desired format. 

 

  • Booking requests should be sent as POST. 

  • All other  requests are sent as GET.

  • Learn more by reviewing the Service Resources.

 

Content-Type = text/xml; charset=UTF-8

• XML accept = application/xml • REST  / XML accept = application/xml • REST  / JSON accept = application/json

(XML requests are case sensitive - REST requests are not)

Here's an example in ASP:

Set xmlhttp = Server.CreateObject("Msxml2.ServerXMLHTTP") 
  xmlhttp.Open "GET", xmlRequestString & XMLdatatosend, false
  xmlhttp.setRequestHeader "Content-Type", "text/xml; charset=UTF-8"
  xmlhttp.setRequestHeader "Accept", "application/xml"
  xmlhttp.send 

Here's an example in C#:

requestString = "http://api.ean.com/ean-services/rs/hotel/v3/list?minorRev=[current minorRev #]&cid=55505&apiKey=[xxx-yourOwnKey-xxx]&customerUserAgent=[xxx]&customerIpAddress=[xxx]&locale=en_US¤cyCode=USD&xml=11/28/201111/30/2011
  2
  ParisFR";

    HttpWebRequest request = WebRequest.Create(requestString.ToString()) as HttpWebRequest;        
    request.ContentType = "text/xml; charset=UTF-8";
    request.Accept = application/xml;     
    using (HttpWebResponse response = request.GetResponse() as HttpWebResponse)
     {
          response.GetResponseStream();
          DataSet dsHotel = new DataSet();
          dsHotel.ReadXml(response.GetResponseStream());
      }

It's also possible to specify the response type within the XML / REST /  JSON request string by adding &_type=xml or &_type=json along  with all other common request parameters.

http://api.ean.com/ean-services/rs/hotel/v3/list?minorRev=[current minorRev #]
&cid=55505
&apiKey=[xxx-yourOwnKey-xxx]
&customerUserAgent=[xxx]
&customerIpAddress=[xxx]
&locale=en_US
&currencyCode=USD
&_type=xml
&xml=
Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

Comments