# Retrieve Associate Images

This endpoint allows you to retrieve property-level or room-level associated images. The request must include the `hotel_id` and either `channel_hotel_id` (for property-level) or `channel_room_id` (for room-level).

***

## <mark style="color:yellow;">Endpoint</mark>

<mark style="color:green;background-color:green;">**`POST`**</mark>&#x20;

<div align="left"><figure><img src="https://958347541-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FM9bn2UcBkeqtqixkl5eF%2Fuploads%2FpsybX0n39kUB8Z8WOk4X%2FSandbox%20image.png?alt=media&#x26;token=4ae73d0f-0d1a-4d73-a4e2-673dbc081d6a" alt="" width="56"><figcaption></figcaption></figure></div>

{% code overflow="wrap" %}
```url
https://connect-sandbox.su-api.com/SUAPI/jservice/bdc/photo/retrieveAssociateImages
```
{% endcode %}

#### <mark style="color:yellow;">Header</mark>

```xml
-app-id: YOUR_APP_ID
Authorization: YOUR_API_KEY
Content-Type:application/json
```

<table><thead><tr><th width="185">Header</th><th width="85">Type</th><th width="101">Required</th><th>Description</th></tr></thead><tbody><tr><td><code>app-id</code></td><td>string</td><td>Yes</td><td>Your application ID. Required for authentication.</td></tr><tr><td><code>Authorization</code></td><td>string</td><td>Yes</td><td>Your API key. for authorization. Required for authentication.</td></tr><tr><td><code>Content-Type</code></td><td>string</td><td>Yes</td><td>Must be set to <code>application/json</code>.</td></tr></tbody></table>

***

#### <mark style="color:yellow;">Attributes</mark>

***

`hotel_id` <mark style="color:orange;">**string (Required)**</mark>

The unique property ID as assigned by the provider upon creation of the property.

***

`channel_hotel_id` <mark style="color:orange;">**string (Required)**</mark>

The unique identifier of the hotel in the specified channel.&#x20;

***

`channel_room_id` <mark style="color:orange;">**string (Required**</mark> <mark style="color:orange;">**for room-level images**</mark>)

The unique identifier of the room in the specified channel. This ID is used to associate an image with a specific room in a hotel on the channel.

***

## <mark style="color:yellow;">**Sample Request**</mark>

### <mark style="color:yellow;">Retrieve property-level associate image</mark>

```json
{
   "hotel_id":"NT7",
   "channel_hotel_id" : "12837615"
}
```

### <mark style="color:yellow;">Retrieve room-level associate image</mark>

```json
{
   "hotel_id":"NT7",
   "channel_room_id": "555555",
   "channel_hotel_id" : "12837615"
}
```

***

## <mark style="color:yellow;">Response</mark>

#### <mark style="color:green;">**Sample Success Response -**</mark> <mark style="color:green;"></mark><mark style="color:green;">Retrieve property-level associate image</mark>

```json
{
   "Status": "Success",
   "Data": {
       "main_photo": {
           "url": "https://www.xxxxxxx.com/xxxx/roadblue/xxxx.jpg",
           "photo_id": "vIY7mKlAoUw",
           "name": "lobby-398845_1280.jpg"
       },
       "is_ordered": true,
       "other_photos": [
           {
               "name": "51eb350001ddfa3b7bb9c2cd1d1d4866.jpeg",
               "url": "https://www.xxxxxxx.com/xxxx/roadblue/xxxx.jpg",
               "photo_id": "2nzdsMfFYJc",
               "tags": [
                   7,
                   8
               ]
           },
           {
               "photo_id": "KAVVUsPDrSg",
               "url": "https://www.xxxxxxx.com/xxxx/roadblue/xxxx.jpg",
               "name": "dc83485eb1ea7771ed71aebe7a31691e.jpeg",
               "tags": []
           }
       ]
   },
   "Message": "Associate Images Retrieved Successfully"
}
```

#### <mark style="color:green;">**Sample Success Response -**</mark> <mark style="color:green;"></mark><mark style="color:green;">Retrieve room-level associate image</mark>

```json
{
   "Status": "Fail",
   "Data": {
       "photos": [
           {
               "name": "51eb350001ddfa3b7bb9c2cd1d1d4866.jpeg",
               "url": "https://www.xxxxxxx.com/xxxx/roadblue/xxxx.jpg",
               "photo_id": "2nzdsMfFYJc"
           },
           {
               "photo_id": "KAVVUsPDrSg",
               "url": "https://www.xxxxxxx.com/xxxx/roadblue/xxxx.jpg",
               "name": "dc83485eb1ea7771ed71aebe7a31691e.jpeg"
           }
       ]
   },
   "Message": "Associate Images Retrieved Successfully"
}
```

#### <mark style="color:yellow;">Response Body Elements</mark>

`Status` <mark style="color:orange;">**string**</mark>

Indicates the result of the API call.&#x20;

{% hint style="info" %}
Will be `"Success"` for successful operations.
{% endhint %}

***

`Data` <mark style="color:orange;">**object**</mark>

Data Contains the associated image data. Data object can have the below parameters:

| **Parameter**  | **Description**                                                                                                       | **Example Value**                                                                                |
| -------------- | --------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------ |
| `main_photo`   | The primary image for the property                                                                                    |                                                                                                  |
| `url`          | URL of the main photo                                                                                                 | [https://www.xxxxxxx.com/xxxx/roadblue/xxxx.jpg](https://www.xxxxxxx.com/xxxx/roadblue/xxxx.jpg) |
| `photo_id`     | Unique identifier for the main photo                                                                                  | vIY7mKlAoUw                                                                                      |
| `name`         | Name of the main photo file                                                                                           | lobby-398845\_1280.jpg                                                                           |
| `is_ordered`   | Indicates if the images are ordered                                                                                   | true                                                                                             |
| `other_photos` | List of additional associated images                                                                                  |                                                                                                  |
| `name`         | Name of each additional photo                                                                                         | 51eb350001ddfa3b7bb9c2cd1d1d4866.jpeg                                                            |
| `url`          | URL of each additional photo                                                                                          | [https://www.xxxxxxx.com/xxxx/roadblue/xxxx.jpg](https://www.xxxxxxx.com/xxxx/roadblue/xxxx.jpg) |
| `photo_id`     | Unique identifier for each additional photo                                                                           | 2nzdsMfFYJc                                                                                      |
| tags           | An array of numeric tags associated with the photo. These tags can be used for categorization or filtering purposes.  |                                                                                                  |
| tagid          | The taguds are represented as integers.                                                                               | For example, 7, 8.                                                                               |

#### Room-Level Associated Images

| **Parameter** | **Description**                             | **Example Value**                                                                                |
| ------------- | ------------------------------------------- | ------------------------------------------------------------------------------------------------ |
| `photos`      | List of associated images                   |                                                                                                  |
| `name`        | Name of each associated photo               | 51eb350001ddfa3b7bb9c2cd1d1d4866.jpeg                                                            |
| `url`         | URL of each associated photo                | [https://www.xxxxxxx.com/xxxx/roadblue/xxxx.jpg](https://www.xxxxxxx.com/xxxx/roadblue/xxxx.jpg) |
| `photo_id`    | Unique identifier for each associated photo | 2nzdsMfFYJc                                                                                      |

***

`Message` <mark style="color:orange;">**string**</mark>

Descriptive message regarding the outcome of the request.

#### <mark style="color:red;">Error</mark>

#### <mark style="color:red;">**Sample Error Response 1**</mark>

```json
{
   "Errors": [
       {
           "Code": "400",
           "ShortText": "HotelCode: Invalid HotelCode ('NT711')"
       }
   ],
   "Status": "Fail"
}
```

#### <mark style="color:red;">**Sample Error Response 2**</mark>

```json
{
   "Errors": [
       {
           "Code": "573",
           "ShortText": "channel-mapping not found for this property!"
       }
   ],
   "Status": "Fail"
}
```

#### <mark style="color:red;">**Sample Error Response 3**</mark>

```json
{
   "Status": "Fail",
   "Errors": [],
   "Message": "Access denied"
}
```

***

<mark style="color:yellow;">**Error Response Body Elements**</mark>

`Status` <mark style="color:orange;">**string**</mark>

Indicates the result of the API call, which will be always `"Fail"` in case of an error response.

***

`Error` <mark style="color:orange;">**array**</mark>

Array that contains details about any errors that occurred during the API call. Each object in the `Errors` array contains the following properties:

`Code` <mark style="color:orange;">**string**</mark>

Specific error code that helps identify the type of error.

{% hint style="info" %}
For example: `"400"` indicates a bad request.
{% endhint %}

`ShortText` <mark style="color:orange;">**string**</mark>

A short description of the error.

***

`Message` <mark style="color:orange;">**string**</mark>

A message providing more information about the error.
