Thumbnails

Note

The Thumbnails API is a work in progress. Breaking changes are planned in the near future.

Media, collections, and users all have thumbnails that are managed through a consistent interface.

Fetching Thumbnails

GET /api2/(resource)/(id)/thumbs
Parameters:
  • resource – One of media, collections or users.
  • id – The ID of the resource to get the thumbnails for.

Uploading a Thumbnail

POST /api2/(resource)/(id)/thumbs

Create an upload URL that will accept the thumbnail image and apply them to the specified item.

Parameters:
  • resource – One of media, collections or users.
  • id – The ID of resource this thumbnail will belong to.
Json Parameters:
 
  • upload_name (required) – The name of the file you would like to upload.
  • upload_size (required) – The size of the file you would like to upload, in bytes.

Example Request:

In order to upload a file, you must first request an upload URL:

POST /api2/media/123/thumbs HTTP/1.1
Content-Type: application/json

{
   "upload_name": "my-image.jpg",
   "upload_size": 1048576
}

Example Response:

If the thumbnail upload is approved, the response will include an upload dict that describes how the file should be uploaded:

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

{
  "upload": {
    "protocols": {
      "form_data": {
        "upload_url": "/api2/users/12312/thumbs/upload",
        "upload_file_param": "thumb",
        "upload_post_params": {}
      }
    }
  }
}

See Upload Protocols for detailed instructions on how to proceed with the upload.

Previous topic

Roles

Next topic

Chooser JavaScript Client

This Page