Posters /posters

Warning

This endpoint is still in development and could be completely changed or removed in next versions.

Use it with caution.

Get the image representation of object object_id as thumbnail url

GET /posters/(object_id)

Get the thumbnail url of an image representation of the object object_id. The thumbnail returned depends from the object type of object_id and from its relations, in particular:

  1. if object object_id has a ‘poster’ relation with an image object then it returns a thumbnail of that image
  2. else if the object is an image then it returns a thumbnail of the object
  3. else if the object has an ‘attach’ relation with an image object then it returns a thumbnail of that image
Request Headers:
 
Parameters:
  • object_id (int|string) – identify a BEdita object. It can be the object id or the object unique name (nickname)
Query Parameters:
 
  • width (int) – the thumbnail width
  • height (int) – the thumbnail height
Response Headers:
 
Status Codes:
  • 200 OK – Success
  • 401 Unauthorized – The object object_id is protected and the request is not authorized
  • 403 Forbidden – The request is authorized but without sufficient permission to access object object_id
  • 404 Not Found – Object object_id not found

Example request:

GET /posters/5 HTTP/1.1
Host: example.com
Accept: application/json, text/javascript
Content-Type: application/json

Example response:

HTTP/1.1 200 Success
Host: example.com
Accept: application/json, text/javascript
Content-Type: application/json

{
 "api": "posters",
 "data": {
   "id": 5,
   "uri": "https://media.server/path/to/thumb/thumbnail.jpg"
 },
 "method": "get",
 "params": [],
 "url": "https://example.com/api/posters/5"
}

Get a collection of image representations

The /posters endpoint can be used also to retrieve a collection of image representations.

GET /posters

If called with id query string parameter the response will contain a collection of the requested posters

The response will be an array of posters as shown below.

Request Headers:
 
Query Parameters:
 
  • id – a comma separated list of object ids. The max number of ids you can request is defined by ApiBaseController::$paginationOptions['maxPageSize']
  • width (int) – the thumbnail width
  • height (int) – the thumbnail height
Response Headers:
 
Status Codes:
  • 200 OK – Success
  • 400 Bad Request – Malformed request
  • 401 Unauthorized – The request is not authorized to access to protected publication
  • 403 Forbidden – The request is authorized but without sufficient permissions to access to protected publication

Example request:

GET /posters?id=1,2,3,4,5 HTTP/1.1
Host: example.com
Accept: application/json, text/javascript

Example response:

HTTP/1.1 200 OK
Content-Type: application/json

{
   "api": "posters",
   "data": [
       {
         "id": 1,
         "uri": "https://media.server/path/to/thumb/thumbnail-1.jpg"
       },
       {
         "id": 2,
         "uri": "https://media.server/path/to/thumb/thumbnail-2.jpg"
       },
       {
         "id": 3,
         "uri": "https://media.server/path/to/thumb/thumbnail-3.jpg"
       },
       {
         "id": 4,
         "uri": "https://media.server/path/to/thumb/thumbnail-4.jpg"
       },
       {
         "id": 5,
         "uri": "https://media.server/path/to/thumb/thumbnail-5.jpg"
       }
   ],


    "method": "get",
    "params": {
        "id": "1,2,3,4,5"
    },
    "url": "https://example.com/api/posters"
}