Master
Versions: Euwe / Fine / Latest /

Picture Management

Management of Pictures adds support of the following actions:

Creating a Picture

POST /api/pictures
{
  "extension": "<extension of image>",
  "content": "<base 64 encoded image here>"
}

Supported extensions include:

Extension

jpg

png

svg

Querying Pictures

Querying pictures like any other collection:

GET /api/pictures?expand=resources
{
  "name": "pictures",
  "count": 5,
  "subcount": 5,
  "resources": [
    {
      "href": "http://localhost:3000/api/pictures/1",
      "id": 1
    },
    ...
    {
      "href": "http://localhost:3000/api/pictures/4",
      "id": 4,
      "resource_id": 1,
      "resource_type": "ServiceTemplate"
    },
    {
      "href": "http://localhost:3000/api/pictures/5",
      "id": 5
    }
  ],
  "actions": [
    {
      "name": "create",
      "method": "post",
      "href": "http://localhost:3000/api/pictures"
    }
  ]
}

This query does not return the pictures themselves, but primary resources for them.

Additional information can be obtained regarding the image binary via the binary_blob attribute:

GET /api/pictures/4?attributes=binary_blob
{
  "href": "http://localhost:3000/api/pictures/4",
  "id": 4,
  "resource_id": 1,
  "resource_type": "ServiceTemplate",
  "binary_blob": {
    "id": 4,
    "resource_type": "Picture",
    "resource_id": 4,
    "md5": "0a38d1998325099141d4c68552440b1d",
    "size": 68314,
    "part_size": 1048576,
    "data_type": "jpg"
  }
}

Actually fetching the particular picture is by getting the image by its href.

The image_href of a picture can be queried as follows:

GET /api/pictures/4?attributes=binary_blob,image_href
{
  "href": "http://localhost:3000/api/pictures/4",
  "id": 4,
  "resource_id": 1,
  "resource_type": "ServiceTemplate",
  "binary_blob": {
    "id": 4,
    "resource_type": "Picture",
    "resource_id": 4,
    "md5": "0a38d1998325099141d4c68552440b1d",
    "size": 68314,
    "part_size": 1048576,
    "data_type": "jpg"
  },
  "image_href": "http://localhost:3000/pictures/4.jpg"
}

In which case the image can simply be downloaded with a GET:

GET http://localhost:3000/pictures/4.jpg

For fetching information about pictures pertaining to services, see the section Querying Pictures for details.