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

Follow

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 http://api.wego.com/hotels/api/search/new?location_id=location_id&check_in=check_in&check_out=check_out&user_ip=user_ip

Example : http://api.wego.com/hotels/api/search/new?location_id=7046&check_in=2011-08-15&check_out=2011-08-18&user_ip=61.8.64.0

You could also check our API documentation for more details : http://www.wego.com/api/hotels#api_search_new.

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 http://api.wego.com/hotels/api/search/new?location_id=location_id&check_in=check_in&check_out=check_out&user_ip=user_ip&ts_code=ts_code

Example : http://api.wego.com/hotels/api/search/new?location_id=7046&check_in=2011-08-15&check_out=2011-08-18&user_ip=61.8.64.0&ts_code=???

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

Comments

  • Avatar
    Uma Shankar Pandey

    Very Helpfull comment thank you