They say an image is worth a thousand words, right? With our API, you can upload images and use them to showcase your products. We use Amazon Web Services to store and serve them through a CDN, so you'll get a good response time and your images stay secure.
Should I set my image to public or private?
__Public images can be used for products, resources, user avatars, etc. Private ones could be used for bills or invoices, for example.
You can only set images to be private programmatically. Images added by an admin on the dashboard will automatically be set to public
Attribute | Type | Description |
|
| The image's name. |
|
| The file type of the image uploaded. |
|
| A boolean indicating if the image is public. The default value is |
|
| The full URL of the public image. |
|
| The image's description. |
|
| The image's title. |
|
| A relative path that you can use to retrieve images. See example below. Whenever possible, use the |
To create an Image
object , which can be associated with products, you can either upload the image to us or supply us with a public URL. We recommend you only link to images and URLs you own and have control over.
Body Parameters | Type | Description |
|
| The image you want to upload. |
|
| Allows you to add some metadata for the image. |
|
| A boolean indicating if the image is public. The default value is |
|
| Gives a title to the image. |
|
| Gives a description to the image. |
POST /images HTTP/1.1Content-Type: image/jpegAuthorization: Bearer <service-account-key>X-Builton-Api-Key: <builton-api-key>Host: api.builton.dev​{"image": <image_bytes>,"metadata": {"key": "value"}}
HTTP/1.1 200 OKContent-Type: application/json​{"_id": {"$oid": "5964a0ead57ke2034200f4e2"},"company": {"$oid": "57ee9c71d76d431f8511142f"},"created": {"$date": 1499767018360},"deleted": false,"modified": {"$date": 1499767018360},"original_name": "file_name","original_file_type": "jpg","url": "image_url","public_url": "image_url/path","public": true,"metadata": {"key": "value"}}
Body Parameters | Type | Description |
|
| The public URL you want to use for your image. |
|
| A boolean indicating if the image is public. The default value is |
|
| Gives a title to the image. |
|
| Gives a description to the image. |
POST /images HTTP/1.1Content-Type: application/jsonAuthorization: Bearer <service-account-key>X-Builton-Api-Key: <builton-api-key>Host: api.builton.dev​{"public_url": "https://images.pexels.com/photos/22221/pexels-photo.jpg","metadata": {"key": "value"},"title": "happy","description": "makes your day better"}
HTTP/1.1 200 OKContent-Type: application/json​{"_id": {"$oid": "5964a0ead57ke2034200f4e2"},"company": {"$oid": "57ee9c71d76d431f8511142f"},"created": {"$date": 1499767018360},"deleted": false,"modified": {"$date": 1499767018360},"public_url": "https://images.pexels.com/photos/22221/pexels-photo.jpg","public": true,"metadata": {"key": "value"},"title": "happy","description": "makes your day better"}
The recommended way to get images is by the image's relative URL, e.g. {IMG_ID}/name, provided in the Image object. However, if you prefer, you can see an example of how to retrieve images using the relative URL below.
Body Parameters | Type | Description |
|
| The image's URL. |
GET /images/<url> HTTP/1.1Authorization: Bearer <service-account-key>X-Builton-Api-Key: <builton-api-key>Host: api.builton.dev
HTTP/1.1 200 OKContent-Type: image/jpegCache-Control: public, max-age=31536000Content-Length: 52204