Channex.io
  • Channex.io Documentation
  • About Channex & FAQ
  • Changelog
  • For OTA
    • Intro
    • Channex Shopping API
    • Open Channel API
  • FOR PMS
    • API Reference
    • API Rate Limits
    • Property Size Limits
    • Properties Collection
    • Property Users Collection
    • Groups Collection
    • Group Users Collection
    • Room Types Collection
    • Rate Plans Collection
    • Availability and Rates
    • Webhook Collection
    • Bookings Collection
    • Channel API
    • Photos Collection
    • Hotel Policy Collection
    • Facilities Collection
    • Taxes and Tax Sets
    • Messages Collection
    • Reviews Collection
    • Channel Codes
    • Channel IFrame
    • PMS Certification Tests
  • Guides
    • PMS Integration Guide
    • Best Practices Guide
    • Test Account for Booking.com
    • Test Accounts for Airbnb
    • Channex Retention Periods
    • Guide to PCI
  • Application Documentation
    • Overview of App Documentation
    • Dashboard
    • Properties and Groups Management
    • Property Tasks
    • Rooms Management
    • Inventory Management
    • Channels Management
    • Channel Log
    • Bookings Management
    • Availability Rules
    • API Key Access
    • Change Log Feature
  • Google Guide
    • Connect Google Channel
    • Google Vacation Rental
    • My Hotel Shop (MHS) Google
  • Channel Mapping Guides
    • Agoda
    • Airbnb
    • Booking.com
    • Ctrip / Trip.com
    • Despegar
    • Dida Travel
    • Emerging Travel
    • Expedia
    • Feratel
    • Getaroom
    • Hipcamp
    • Hostelworld
    • Hopper
    • Hopper Homes
    • Hotelbeds
    • HotelTonight
    • HyperGuest
    • HRS
    • Inntopia
    • Instant Booking Page
    • MakeMyTrip / Goibibo
    • Mg Bedbank
    • OpenGDS
    • Roibos
    • Traveloka
    • Tiket.com
    • VRBO
  • App Guide
    • Apaleo
    • PCI App
Powered by GitBook
On this page
  • Photos List
  • Returns
  • Get Photo by ID
  • Returns
  • Create Photo
  • Fields
  • Returns
  • Upload Photo
  • Update Photo
  • Fields
  • Returns
  • Remove Photo
  • Returns
  • Batch operations

Was this helpful?

  1. FOR PMS

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

Success Response Example

Status Code: 200 OK

{
  "data": [
    {
      "attributes": {
        "author": null,
        "description": null,
        "id": "ae75d43e-21c5-46b6-a593-5046791f7841",
        "kind": "ad",
        "position": 0,
        "property_id": "52397a6e-c330-44f4-a293-47042d3a3607",
        "room_type_id": null,
        "url": "https://img.channex.io/312fa6cb-8151-409b-b612-773e271a76df/"
      },
      "id": "ae75d43e-21c5-46b6-a593-5046791f7841",
      "type": "photo"
    }
  ],
  "meta": {}
}

Unauthorised Error Response

Status Code: 401 Unauthorized

{
  "errors": {
    "code": "unauthorized",
    "title": "Unauthorized"
  }
}

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

Success Response Example

Status Code: 200 OK

{
  "data": {
    "attributes": {
      "author": null,
      "description": null,
      "id": "ae75d43e-21c5-46b6-a593-5046791f7841",
      "kind": "ad",
      "position": 0,
      "property_id": "52397a6e-c330-44f4-a293-47042d3a3607",
      "room_type_id": null,
      "url": "https://img.channex.io/312fa6cb-8151-409b-b612-773e271a76df/"
    },
    "id": "ae75d43e-21c5-46b6-a593-5046791f7841",
    "type": "photo"
  }
}

Unauthorised Error Response

Status Code: 401 Unauthorized

{
  "errors": {
    "code": "unauthorized",
    "title": "Unauthorized"
  }
}

Not Found Error

Status Code: 404 Not Found

{
  "errors": {
    "code": "not_found",
    "title": "Resouce Not Found"
  }
}

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
  }
}

Success Response Example

Status Code: 201 Created

{
  "data": {
    "attributes": {
      "author": "Author Name",
      "description": "Room View",
      "id": "656d8cab-beaa-45a3-8ddb-44684816edba",
      "kind": "photo",
      "position": 0,
      "property_id": "52397a6e-c330-44f4-a293-47042d3a3607",
      "room_type_id": null,
      "url": "https://img.channex.io/af08bc1d-8074-476c-bdb7-cec931edaf6a/"
    },
    "id": "656d8cab-beaa-45a3-8ddb-44684816edba",
    "type": "photo"
  }
}

Unauthorised Error Response

Status Code: 401 Unauthorized

{
  "errors": {
    "code": "unauthorized",
    "title": "Unauthorized"
  }
}

Validation Error Response

Status Code: 422 Unprocessable Entity

{
  "errors": {
    "code": "validation_error",
    "title": "Validation Error",
    "details": {
      "url": [
        "can't be blank"
      ]
    }
  }
}

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
  }
}

Success Response Example

Status Code: 200 OK

{
  "data": {
    "attributes": {
      "author": "Author Name",
      "description": "Room View",
      "id": "656d8cab-beaa-45a3-8ddb-44684816edba",
      "kind": "photo",
      "position": 0,
      "property_id": "52397a6e-c330-44f4-a293-47042d3a3607",
      "room_type_id": null,
      "url": "https://img.channex.io/af08bc1d-8074-476c-bdb7-cec931edaf6a/"
    },
    "id": "656d8cab-beaa-45a3-8ddb-44684816edba",
    "type": "photo"
  }
}

Unauthorised Error Response

Status Code: 401 Unauthorized

{
  "errors": {
    "code": "unauthorized",
    "title": "Unauthorized"
  }
}

Not Found Error

Status Code: 404 Not Found

{
  "errors": {
    "code": "resource_not_found"
    "title": "Resource Not Found"
  }
}

Validation Error Response

Status Code: 422 Unprocessable Entity

{
  "errors": {
    "code": "validation_error",
    "title": "Validation Error",
    "details": {
      "url": [
        "can't be blank"
      ]
    }
  }
}

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

Success Response Example

Status Code: 200 OK

{
  "meta": {
    "message": "Success"
  }
}

Unauthorised Error Response

Status Code: 401 Unauthorized

{
  "errors": {
    "code": "unauthorized",
    "title": "Unauthorized"
  }
}

Not Found Error

Status Code: 404 Not Found

{
  "errors": {
    "code": "resource_not_found"
    "title": "Resource Not Found"
  }
}

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

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.

PreviousChannel APINextHotel Policy Collection

Last updated 1 month ago

Was this helpful?

API methods to create or update or 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.

Property
Room Type