Images
Covered in this doc:

List images

List all images uploaded within a Site
1
GET /api/v2/images/?site_id=12345
Copied!

Parameters

Name
Type
Description
site_id
string
optional ID of the Site you want to get the images for

Response

1
{
2
"meta": {
3
"limit": 20,
4
"next": "/api/v2/images/?limit=20&offset=20",
5
"offset": 0,
6
"previous": null,
7
"total_count": 5
8
},
9
"objects": [
10
{
11
"added": "2012-06-01T09:28:46",
12
"height": 1400,
13
"id": 1194687,
14
"image": "img/upload/c1_26.jpg",
15
"mimetype": "image/jpeg",
16
"modified": "2012-06-01T09:28:46",
17
"resource_uri": "/api/v2/images/1194687/",
18
"site_id": 12345,
19
"sizes": {
20
"big": "img/upload/c1_26.big.jpg",
21
"large": "img/upload/c1_26.large.jpg",
22
"medium": "img/upload/c1_26.medium.jpg",
23
"original": "img/upload/c1_26.jpg",
24
"small": "img/upload/c1_26.small.jpg",
25
"thumbnail": "img/upload/c1_26.thumbnail.jpg"
26
},
27
"user_id": 54321,
28
"width": 1304
29
},
30
...
31
]
32
}
Copied!

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:
1
https://yourprivatelabel.cloudfrontend.net/img/upload/c1_26.jpg
Copied!

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.
1
<img src="/img/upload/c1_26.jpg">
Copied!
1
.body { background-image: url('/img/upload/c1_26.jpg'); }
Copied!

Upload a new image (via an External URL)

1
POST /api/v2/images/
Copied!

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

1
{
2
"site_id": 12345,
3
"external_url": "http://www.examples.com/full/path/to/image.jpg"
4
}
Copied!

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)

1
POST /api/v2/images/
Copied!

Parameters

Name
Type
Description
upload
object
required
site_id
int
optional

Example

1
{
2
"site_id": 12345,
3
"upload": {
4
"name": "image.jpg",
5
"file": "iVBORw0KGgoAAAANSUhEUgAAASAAAABsCAIAAABFDPh0AAAAGXRFWHRTb2Z0d2F..."
6
}
7
}
Copied!

Response

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