Aug 01, 2013 | API changes: Mandatory user_ip and ts_code


Mandatory user_ip

We are constantly looking to improve our API and one of the new features that we have implemented is tailoring search results based on the visitor's market. At this point, if there is a lower rate for a particular hotel for visitors from Australia, we would be displaying standard rates to visitors via our API, as opposed to the discounted rates. This is because our engine is not able to detect where your visitor is from. So, we have created a feature wherein, if you submit the IP of the visitor within the call, we will return market specific rates.

Thus, in order for this to work, we would need you to pass the visitor's IP on every call. Technically, you would simply need to pass user_ip=(end user IP) in the search query.

Query : GET

Example :

You could also check our API documentation for more details :

Some sample codes in various languages i.e for PHP, Rails & Node.JS to get the end user's IP :

  • for PHP: <?php echo $_SERVER["REMOTE_ADDR"]; ?>
  • for NODE.JS: req.connection.remoteAddress
  • for Ruby on Rails: request.remote_ip

Mandatory ts_code

Another important improvement is to do with providing you with the right report numbers. We have received feedback that our reporting interfaces do not often show the right number of searches or clicks. We have realised that in most cases this is because the API call sent by some of our affiliates does not contain the ts_code parameter. We thus urge you to pass the ts_code parameter on every call that you make. Your unique ts_code was given to you when you signed up for the API.

Query : GET

Example :

Note that we will be making both these parameters mandatory i.e. the API will cease to return results if these 2 parameters are not passed.

We understand that you would have your own development timelines and hence will be giving you a month to implement the changes before we make it mandatory. Thus our API will stop responding to calls from the 01 of September if these 2 parameters are not passed. Once again thank you for your feedback and we hope to keep coming up with new features and improvements to enhance the API and subsequently your end user's experience.

Have more questions? Submit a request


  • Avatar
    Uma Shankar Pandey

    Very Helpfull comment thank you