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"

Here's an example in C#:

requestString = "[current minorRev #]&cid=55505&apiKey=[xxx-yourOwnKey-xxx]&customerUserAgent=[xxx]&customerIpAddress=[xxx]&locale=en_US¤cyCode=USD&xml=11/28/201111/30/2011

    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)
          DataSet dsHotel = new DataSet();

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.[current minorRev #]
Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request