MEDIA API
Get Room Images API
Technical documentation for the method that builds and sends booking data as JSON.
Summary
| Purpose | Retrieve the images of a room from the database and send them as a list of URLs to Channel Manager. |
| Entry Method | POST /getApiRoomImages |
| Input | roomId as an object in the request body. |
| Output | A RoomImages object containing the list of image URLs. |
Description
This endpoint is used to retrieve all images associated with a specific room, build the full URLs by prepending the base https://allbookers.com, and return them as a list of strings inside a RoomImages object.
Endpoint
POST
/getApiRoomImages
Request
Content-Type: application/json
Authorization: Bearer <token>
| Field | Type | Description |
|---|---|---|
| roomId | Long | Room identifier |
Request Body Example
{
"roomId": 12
}
Process
- The Room is fetched from the database using roomId.
- All RoomPhoto entries of the room are iterated.
- For each photo, the full URL is built by prepending https://allbookers.com to the imagePath.
- The URLs are stored in a list of strings.
- The list is placed inside a RoomImages object and returned as the response.
JSON Structure Sent
| Field | Type | Description |
|---|---|---|
| imgPath | Array of String | List of full image URLs for the room. |
Example JSON Sent
{
"imgPath": [
"https://allbookers.com/images/room12/photo1.jpg",
"https://allbookers.com/images/room12/photo2.jpg"
]
}
Headers
Content-Type: application/jsonAccept: application/json
Example Response
{
"success": true,
"message": "Rooms imported successfully"
}
Notes
- If the specified room identifier does not exist in the database, the operation may result in an exception due to the way the data is retrieved. A controlled error-handling approach is recommended to manage this scenario more safely.
- Image URLs are constructed by combining the base domain with the image path stored in the database. It is important to ensure that the image path is correctly formatted so that the resulting URL is valid.