Photos Collection

API Methods to work with Photos

Photo is entity to represent photo associated with Property and Room Type (optional).

Photos List

Retrieve list of Photos associated with user Properties.

Request:

GET https://staging.channex.io/api/v1/photos

Returns

Success Method can return a Success result with 200 OK HTTP Code if operation is successful. Will contain a list of Photo objects in the answer. Unauthorised Error Method can return a Unauthorised Error result with 401 Unauthorized HTTP Code if wrong Bearer Token provided.

Get Photo by ID

Retrieve specific Photo by ID.

Request:

GET https://staging.channex.io/api/v1/photos/:id

Returns

Success Method can return a Success result with 200 OK HTTP Code if operation is successful. Will contain a Photo object in the answer. Unauthorised Error Method can return a Unauthorised Error result with 401 Unauthorized HTTP Code if wrong Bearer Token provided or User not have access to requested Photo.

Not Found Error Method can return a Not Found Error result with 404 Not Found HTTP Code if Photo with provided ID is not present at system.

Create Photo

Create new Photo.

Request:

POST https://staging.channex.io/api/v1/photos

Query body (JSON):

{
  "photo": {
    "author": "Author Name",
    "description": "Room View",
    "kind": "photo",
    "position": 0,
    "url": "https://img.channex.io/af08bc1d-8074-476c-bdb7-cec931edaf6a/",
    "property_id": "52397a6e-c330-44f4-a293-47042d3a3607",
    "room_type_id": null
  }
}

Fields

property_id [required]

String with valid UUID of Property object what you would like to associate with created Photo.

url [required]

Valid URL address of Photo image.

room_type_id [optional]

String with valid UUID of Room Type object what you would like to associate with created Photo. If room_type_id is null, Photo will be associated only with Property.

kind [optional]

One of three possible values: photo, ad (advertising), menu (restaurant menu photo). By default value kind will be equal to photo.

author [optional]

Name of photo author.

description [optional]

Text with Photo description.

position [optional]

Any positive integer number. This field represent Photo position at list of Property or Room Type Photos. Photo with position equal to 0 is used as Cover Photo. Position should be uniq per property_id and room_type_id combination.

Returns

Success Method can return a Success result with 201 Created HTTP Code if operation is successful. Will contain a Photo object in the answer.

Unauthorised Error Method can return a Unauthorised Error result with 401 Unauthorized HTTP Code if wrong Bearer Token provided.

Validation Error Method can return a Validation Error result with 422 Unprocessable Entity HTTP Code if any validation rule is failed.

Upload Photo

To upload Photos and create it you should use next API:

POST https://staging.channex.io/api/v1/photos/upload

--form 'photo=@"paht_to_photo/photo.jpg"

In response you will get a link to temporary photo:

{
    "url": "https://ams3.digitaloceanspaces.com/temporaryphotos/a66edb22-47da-4da8-bab5-3b6f4056256f.jpg"
}

Then you can use this url in Create Photo API call.

Update Photo

Update Photo.

Request:

PUT https://staging.channex.io/api/v1/photos/:id

Query body (JSON):

{
  "photo": {
    "author": "Author Name",
    "description": "Room View",
    "kind": "photo",
    "position": 0,
    "url": "https://img.channex.io/af08bc1d-8074-476c-bdb7-cec931edaf6a/",
    "property_id": "52397a6e-c330-44f4-a293-47042d3a3607",
    "room_type_id": null
  }
}

Fields

This method use same fields as Create Photo method.

Returns

Success Method can return a Success result with 200 OK HTTP Code if operation is successful. Will contain a Photo object in the answer. Unauthorised Error Method can return a Unauthorised Error result with 401 Unauthorized HTTP Code if wrong Bearer Token provided.

Not Found Error Method can return a Not Found Error result with 404 Not Found HTTP Code if Photo with provided ID is not present at system.

Validation Error Method can return a Validation Error result with 422 Unprocessable Entity HTTP Code if any validation rule is failed.

Remove Photo

Remove Photo.

Request:

DELETE https://staging.channex.io/api/v1/photos/:id

Returns

Success Method can return a Success result with 200 OK HTTP Code if operation is successful. Will contain a Meta object with message in the answer.

Unauthorised Error Method can return a Unauthorised Error result with 401 Unauthorized HTTP Code if wrong Bearer Token provided.

Not Found Error Method can return a Not Found Error result with 404 Not Found HTTP Code if Photo with provided ID is not present at system.

Batch operations

API methods to create or update Property or Room Type have implementation of Photo batch operations. To create Property with Photos, you can pass list of Photo arguments as value into content.photos key of affected object.

Batch operations support logic to create new Photo entity associated with parent object, update existed photos or drop it.

To update Photo at batch operation, you must provide photo with it ID.

To drop Photo at batch operation, you can pass additional optional key: is_removed with value equal to true at Photo object what are you like to remove.

Baseline loading.

Progressive loading.

Last updated

Was this helpful?