DevHub API Documentation
  • Introduction
  • Authentication
  • Errors
  • Getting started guides
    • Business-focused Sites
    • Location-focused Sites
    • Location pages and store locator with custom theme
    • Site publishing with site builder access
  • Code examples
    • Python
    • PHP
    • Perl
  • Best practices
    • Our unique IDs, versus yours
    • State and country codes
  • Core Resources
    • Sites
    • Businesses
    • Locations
    • Domains
    • Proxies
  • Content Resources
    • Pages
    • Content
    • Images
    • Files
    • Modules
    • Plugins
    • Themes
  • Logging and analytics
    • Analytics
    • Contact Logs
  • Single Sign On (SSO)
    • Introduction
    • Assigning a site's user
  • Live Preview API
    • What is the Live Preview API?
  • Advanced
    • Domain aliases
    • Language codes
    • Projects
    • Site Check
    • Traces
    • Webmail
  • Local Storage API
    • What is the Local Storage API?
  • Headless CMS
    • Locations search
  • Visitor Localization SDK
    • Visitor Localization SDK
Powered by GitBook
On this page
  • List images
  • Parameters
  • Response
  • Full URI of images
  • Linking to images
  • Upload a new image (via an External URL)
  • Parameters
  • Response
  • Upload a new image (via base64)
  • Parameters
  • Response

Was this helpful?

  1. Content Resources

Images

PreviousContentNextFiles

Last updated 6 years ago

Was this helpful?

Covered in this doc:

List images

List all images uploaded within a Site

GET /api/v2/images/?site_id=12345

Parameters

Name

Type

Description

site_id

string

optional ID of the Site you want to get the images for

Response

{
  "meta": {
    "limit": 20,
    "next": "/api/v2/images/?limit=20&offset=20",
    "offset": 0,
    "previous": null,
    "total_count": 5
  },
  "objects": [
    {
      "added": "2012-06-01T09:28:46",
      "height": 1400,
      "id": 1194687,
      "image": "img/upload/c1_26.jpg",
      "mimetype": "image/jpeg",
      "modified": "2012-06-01T09:28:46",
      "resource_uri": "/api/v2/images/1194687/",
      "site_id": 12345,
      "sizes": {
        "big": "img/upload/c1_26.big.jpg",
        "large": "img/upload/c1_26.large.jpg",
        "medium": "img/upload/c1_26.medium.jpg",
        "original": "img/upload/c1_26.jpg",
        "small": "img/upload/c1_26.small.jpg",
        "thumbnail": "img/upload/c1_26.thumbnail.jpg"
      },
      "user_id": 54321,
      "width": 1304
    },
    ...
  ]
}

Full URI of images

Any image file is available publicly using the image parameter from the response and prefixing it with the frontend hostname of your API instance.

Example:

https://yourprivatelabel.cloudfrontend.net/img/upload/c1_26.jpg

Linking to images

If you are using uploaded images within hosted Sites (CSS, HTML, etc), you should reference these images by their local path. You do not want to directly link to yourprivatelabel.cloudfrontend.net.

<img src="/img/upload/c1_26.jpg">
.body { background-image: url('/img/upload/c1_26.jpg'); }

Upload a new image (via an External URL)

POST /api/v2/images/

Parameters

Name

Type

Description

site_id

integer

optional Site to upload the image to

external_url

string

required Publicly accessible url for the image to be fetched by our system and uploaded

Example

{
  "site_id": 12345,
  "external_url": "http://www.examples.com/full/path/to/image.jpg"
}

Response

A status code of 201 created is returned on a successful creation and contains the created image object as JSON.

Upload a new image (via base64)

POST /api/v2/images/

Parameters

Name

Type

Description

upload

object

required

site_id

int

optional

Example

{
  "site_id": 12345,
  "upload": {
    "name": "image.jpg",
    "file": "iVBORw0KGgoAAAANSUhEUgAAASAAAABsCAIAAABFDPh0AAAAGXRFWHRTb2Z0d2F..."
  }
}

Response

A status code of 201 created is returned on a successful creation and contains the created image object as JSON.

List images
Upload a new image (via an External URL)
Upload a new image (via base64)