Booking COM

FREEMIUM
By Things4u | Updated vor 12 Tagen | Travel
Popularity

9.6 / 10

Latency

1,431ms

Service Level

100%

Health Check

100%

Back to All Discussions

how to acess the photos

Rapid account: Rizangabriel 1
rizangabriel1
vor 18 Tagen

Hello,
I was wondering for the endpoint stays/get-photos
how do i actually access the photos, as I wanted to store them in an array initially

Debugging through console logging i found that
If i do console.log(response.data.data) i get an answer including the id

however if i try to access one step down, accesing the id i get undefined
for example console.log(response.data.data[id])
what is the issue here? am I doing something wrong

Rapid account: Rizangabriel 1
rizangabriel1 Commented vor 17 Tagen

Thank you very much!

Rapid account: Ntd 119
ntd119 Commented vor 18 Tagen

Hi,

I see you called the /stays/get-photos endpoint with hotelId=314769,
And the response is as follows (response is too long, so I shortened it):
{
“data”: {
"__typename": “hoteldescriptionphotosResults”,
“data”: {
“314769”: [
[
1,
[],
543117479,
[],
[
"/xdata/images/hotel/square60/543117479.jpg?k=82b6364aea155047f8dca46e0235a81abcc5277255e247fdd0de33baee491985&o=",
"/xdata/images/hotel/max1024x768/543117479.jpg?k=82b6364aea155047f8dca46e0235a81abcc5277255e247fdd0de33baee491985&o=",
"/xdata/images/hotel/max100/543117479.jpg?k=82b6364aea155047f8dca46e0235a81abcc5277255e247fdd0de33baee491985&o=",
"/xdata/images/hotel/max200/543117479.jpg?k=82b6364aea155047f8dca46e0235a81abcc5277255e247fdd0de33baee491985&o=",
"/xdata/images/hotel/max300/543117479.jpg?k=82b6364aea155047f8dca46e0235a81abcc5277255e247fdd0de33baee491985&o="
]
]
]
},
“data_key”: “hotel_id”,
“url_prefix”: “http://cf.bstatic.com”,
“available_rooms”: null
},
“status”: true,
“message”: “Successful”
}

If you want to access the image, you can use the url_prefix + image_url.
For example: http://cf.bstatic.com/xdata/images/hotel/max200/543117479.jpg?k=82b6364aea155047f8dca46e0235a81abcc5277255e247fdd0de33baee491985&o=
You can check if it works by pasting it into a web browser.

Thanks

Join in the discussion - add comment below:

Login / Signup to post new comments