CHR API-GATEWAY Utils


Page listings

Every page listing contains links and meta where is infoormation about pagination and total number of items

Example

{
  "data": [
    {

    }
  ],
  "links": {
        "first": "URL/v1\/destinations?_includes=images%2Cparent_destination&_page=1",
        "last": "URL/v1\/destinations?_includes=images%2Cparent_destination&_page=16",
        "prev": null,
        "next": "URL/v1\/destinations?_includes=images%2Cparent_destination&_page=2"
    },
    "meta": {
        "current_page": 1,
        "from": 1,
        "last_page": 16,
        "path": "URL/v1\/destinations",
        "per_page": 10,
        "to": 10,
        "total": 156
    }
}

Change pagination

Param Description
_per_page change nr of items per page
_page change page number

Example

curl --request GET \
  --url 'URL/v1/hotels?_per_page=1000&_page=2' \
  --header 'Authorization: Bearer TOKEN'

Image dimensions

to request diferent image sizes use param _image_dimensions

Param Description
_image_dimensions request diferent image sizes

Example

curl --request GET \
  --url 'URL/v1/hotels?_image_dimensions=_image_dimensions=200X300,300X400&_includes=images' \
  --header 'Authorization: Bearer TOKEN'
{
  "images": {
    "data": [
      {
        "id": 79629,
        "hotel_id": 12870,
        "name": "",
        "description": "",
        "file": {
          "200X300": "URL/Jh0RCZXj0b1uqgzXkdlTa4B9IKY=\/fit-in\/200x300\/\/storage\/hotels\/occidental-playa-de-palma-456.jpg",
          "300X400": "URL/Kz-oA3A0vhJnBR1c-1MJNqVl-7I=\/fit-in\/300x400\/\/storage\/hotels\/occidental-playa-de-palma-456.jpg"
        },
        "order": 0,
        "is_active": true,
        "is_main": false,
        "created_at": "2019-05-30T22:24:00+03:00",
        "updated_at": "2019-05-30T22:24:00+03:00"
      }
    ]
  }
}

Swagger

Swagger documentation can be found here

Help

write us at victor[at]thewebroom.ro