Menu

Bedful Images

Images represent image files on the bedful system, and are associated with Sites, Units, and Extras. Each of these resources may have multiple images, and you'll find them on those records when expanded. Normally you won't need to fetch image records independently of the resources they are associated with.

Copyright

These images are copyright by our partners and Bedful, and may not be reused on another website without our explicit permission in writing. Similarly our assets servers should not be used to serve images on your website without our explicit permission in writing.

Asset urls

The actual image data is stored and served from our assets servers at assets.bedful.com, so the bedful API will only return image records containing a hash which refers to a specific url on the bedful asset servers. Images are identified by a hash of their contents, this means if an image changes, the path changes too and a new resources is created. Conversely if the same image is uploaded multiple times, it will point to the same resource.

You can construct a url for this image on our assets servers as follows, where HASH is the image hash, and NAME is any identifier. Name will be ignored and only hash is used to select the image.

https://assets.bedful.com/images/:hash/:size/name.jpg

Size may be one of icon, small, large or original. Name is present for seo and is ignored when serving images. So for example, the demo image below may be fetched with this url:

https://assets.bedful.com/images/2f36fffb284d810561e223d3c8e3e1018799f53f/icon/name.jpg

Get Image

Use GET /images/:id to fetch information on one image.

curl https://devapi.bedful.com/images/1 \
-u BEDFUL_KEY: 

Parameters available

  • id : specified in the url

This will return JSON like this for the matched record, or a 404 error if no record is found for the given id.

{
    "id": 1,
    "name": "Demo",
    "hash": "2f36fffb284d810561e223d3c8e3e1018799f53f",
    "sort": 70
}
Image Fields
  • ID: The unique id of the image
  • Name: The name of the image
  • Hash: A hash of the image contents, used to identify the image on our asset servers
  • Sort: The order this image is to be presented in

Get Images

Use GET /images to fetch information on more than one image. Normally image records will be fetched as part of an expanded view of a site or unit.

curl https://devapi.bedful.com/images \
-u BEDFUL_KEY: 

Parameters available

  • unit_id : filter on the image unit
  • site_id : filter on the image site
  • filter: filter on the image name (case sensitive)

This will return JSON like this for the matched records, or an empty list if no records are found.

 {
  "images": [
    {
    "id": 1,
    "name": "Demo",
    "hash": "2f36fffb284d810561e223d3c8e3e1018799f53f",
    "sort": 70
    }
  ]
}