ReferenceImage API

Responses

The Image API response message is returned synchronously and allows Expedia Group to send the status of an Image API request. All responses provided by the API will either contain an an entity attribute, which may represent a single object or an array of objects, or an errors attribute that provides an array of errors.

Entity and errors are in the same wrapper because most frameworks will deserialize responses automatically but require a target type to which the response will be deserialized. Both successful and unsuccessful responses are returned by the same DTO but can have either entity or errors (never both).

A Java implementation to handle this, using Spring’s RestTemplate, could look like this:

1ResponseEntity<ResponseWrapperDTO<RoomTypeDTO>> response =
2restTemplate.exchange(
3 "url",
4 HttpMethod.POST,
5 entity,
6 new ParameterizedTypeReference<ResponseWrapperDTO<RoomTypeDTO>>() {}
7);

HTTP headers

Header

Type

Format

Content-Type

String

Content-Type: application/json

Request-ID

String

Partner-provided request identifier. If it was not provided in the request, Expedia Group will generate a Request-ID and return it in the response

Transaction-ID

GUID

Unique transaction ID generated by Expedia Group for all messages. Expedia Group recommends storing this identifier. Can be used to reference messages when troubleshooting with Expedia Group

Entity attribute

The only supported entity by Image API is image.

The Entity approach allows you to use the same wrapper for all resources exposed by Expedia Group’s Product API and Image API services.

Consider the following code in Java:

1public class ResponseWrapperDTO<T> implements Serializable {
2 private T entity;
3 private List<ErrorDTO> errors;
4}

Here is a simple entity response:

1{
2 "entity": {
3 "resourceId": "b3c659b8-7ca1-4a6c-8d6a-a2b54438b024",
4 "state": "Received"
5 }
6}```
8There are two different read operations available against the Image API’s resources:
10- To get a specific resource, the resource ID needs to be specified on the URL.
12 Example: /properties/{propertyId}/images/{ImageId}
14- To get all the active resources in the system, omit the resource ID on the URL.
16 Example: /properties/{propertyId}/images
18When requesting a single image, Image API will return the Image resource
19information as part of an Entity object:
21```json
22{
23 "entity": {
24 "resourceId": 1,
25 ...
26 }
27}

When requesting all images assigned for a property, an array of images is returned:

1{
2 "entity": [
3 {
4 "resourceId": 1,
5
6 },
7 {
8 "resourceId": 2,
9
10 }
11 ]
12}

Errors attribute

If a response doesn’t contain an entity, it will contain errors:

1{
2 "errors": [
3 {
4 "code": 1000,
5 "message": "Access denied: your account is not authorized to manage this property."
6 }
7 ]
8}

Property Name

Type

Description

code

integer

Full list of error codes.

message

string