asp.net - Get list of Hotels and room images from Expedia -
using asp.net want hotels , corresponding properties such hotel , room images expedia.
it gives properties expect images. want hotel , room images hotel list service. should achieve this?this request
var serviceclient = new hotelservicesclient("expediaserviceport"); var servicerequest = new hotellistrequest(); servicerequest.apikey = _apikey; servicerequest.locale = _culture == "tr" ? localetype.tr_tr : localetype.en_us; servicerequest.localespecified = true; servicerequest.currencycode = _culture == "tr" ? "try" : "eur"; servicerequest.suppliertype = "e"; servicerequest.searchradius = 100; servicerequest.searchradiusspecified = true; servicerequest.searchradiusunit = searchradiusunittype.km; servicerequest.searchradiusunitspecified = true; servicerequest.arrivaldate = hotellistrequest.arrivalat.tostring("mm/dd/yyyy", cultureinfo.invariantculture); servicerequest.departuredate = hotellistrequest.departureat.tostring("mm/dd/yyyy", cultureinfo.invariantculture); servicerequest.roomgroup = new[] { new room { numberofadults = hotellistrequest.adultcount, numberofchildren = hotellistrequest.childcount } }; servicerequest.sort = sorttype.price; servicerequest.sortspecified = true; servicerequest.numberofresults = 50; servicerequest.numberofresultsspecified = true; if (hotellistrequest.latitude.hasvalue && hotellistrequest.longitude.hasvalue) { servicerequest.latitude = (float)hotellistrequest.latitude.value; servicerequest.latitudespecified = true; servicerequest.longitude = (float)hotellistrequest.longitude.value; servicerequest.longitudespecified = true; } else { servicerequest.destinationstring = hotellistrequest.city; } var hotellistresponse = new entity.hotellist.hotellistresponse(); var response = serviceclient.getlist(servicerequest); if (response.eanwserror != null) throw new exception(response.eanwserror.verbosemessage); hotellistresponse.cachekey = response.cachekey; hotellistresponse.cachelocation = response.cachelocation; hotellistresponse.hasmore = response.moreresultsavailable; if (true) { foreach (var servicehotel in response.hotellist.hotelsummary) { var hotel = new entity.hotel { refid = servicehotel.hotelid, url = hotelurl(servicehotel.hotelid, _htmldecodefunc(servicehotel.name)), .......
the list api not provide hotel images, thumbnail. there 3 places images, info (hotel images), roomimages, , avail (room images).
with thumbnail provided list (or api), can various formats replacing final '_b.' '_l.' (landscape),'_s.' (small), or .... full replace values listed here: http://developer.ean.com/database_catalogs/relational/image_data https://support.ean.com/entries/21965722-additional-image-sizes-available
remember, limited 40 requests/second on production getting images results of list eat quickly. if using local versions of db files, can images list without pinging api. first link above has download location file , requires local (no)sql integration.
Comments
Post a Comment