Media
The article highlights the API endpoints and simple methods used to add photos and videos for products on Omnitron.
On the Omnitron panels, there are Product Pictures and Product Videos sections on the detail pages of the existing or pending products in Products and Catalogs > Product Pool and Integration > Pending Products.

Frontend images and videos are sent to Omnitron via API.
The accepted file formats for the images are .png
, .jpg
, and .jpeg
.
To customize image dimensions, the following dynamic setting is used:
MAX_IMAGE_DIMENSIONS
This setting is employed to set the maximum dimensions of product images. Its purpose is to ensure that product images do not exceed specific width and height values, typically configured to maintain image quality, optimize page loads, and enhance overall performance.
Default values are as follows:
MAX_IMAGE_DIMENSIONS = {'WIDTH': 2000, 'HEIGHT': 2000}
Path:
/api/v1/dynamic_settings/
Method:
POST
Body:
{ "key": "MAX_IMAGE_DIMENSIONS", "value": {"WIDTH": 3000, "HEIGHT": 3000} }
HTTP Methods
GET
Product Images
GET
Product ImagesThis method is used to get images of products.
Path: /api/v1/product_image/?limit=100&product={product_pk}
Response
{
"count": 3,
"next": null,
"previous": null,
"results": [
{
"pk": 491,
"product": 16201, #product pk
"image": "https://{customer_omnitron_url}/products/2017/03/24/16201/7ab3a475-d208-4650-bb14-053acf955daa.jpg",
"order": 0,
"source": "integration",
"modified_date": "2022-11-25T12:06:42.954200Z",
"created_date": "2022-11-25T12:06:42.954186Z"
},
{
"pk": 493,
"product": 16201, #product pk
"image": "https://{customer_omnitron_url}/products/2017/03/24/16201/2906fa81-8c3e-41fa-9884-904ca431cd5e.jpg",
"order": 1,
"source": "integration",
"modified_date": "2022-11-25T12:06:42.954200Z",
"created_date": "2022-11-25T12:06:42.954186Z"
},
{
"pk": 494,
"product": 16201, #product pk
"image": "https://{customer_omnitron_url}/products/2017/03/24/16201/f8dc7c1e-3f5d-4cc2-965c-4aa72bf15e1f.jpg",
"order": 2,
"source": "integration",
"modified_date": "2022-11-25T12:06:42.954200Z",
"created_date": "2022-11-25T12:06:42.954186Z"
}
]
}
GET
Product Videos
GET
Product VideosThis method is used to get videos of products.
Path: /api/v1/product_video/?limit=100&product={product_pk}
Response
{
"count": 2,
"next": null,
"previous": null,
"results": [
{
"pk": 168,
"product": 52,
"video": "https://{customer_omnitron_url}/product_videos/2020/06/05/814a770c-96f4-4f1e-85e4-f100ffcabc96.mp4",
"order": 0,
"modified_date": "2022-07-05T05:36:03.865894Z",
"created_date": "2022-07-05T05:36:03.865865Z"
},
{
"pk": 169,
"product": 52,
"video": "https://{customer_omnitron_url}/product_videos/2020/06/05/f77661e0-023b-4688-a43e-02c8d37ec836.mp4",
"order": 1,
"modified_date": "2022-07-05T05:36:03.865894Z",
"created_date": "2022-07-05T05:36:03.865865Z"
}
]
}
POST
Create Product Image
POST
Create Product ImageThis method is used to upload images of products.
Path: /api/v1/product_image/
Parameter
Detail
product
PK information of the product with media
image
Image with .png or .jpeg extension
video
Video with .mp4 extension
source
Indicates what source the image came from Enum field (integration or unified values)
{
"image": {File},
"product": {product_pk},
"source": "integration"
}
Response
{
"pk":20026,
"product":1,
"image":"http://{customer_omnitron_url}/media/products/2021/05/25/1/5e0b2bc0-bee2-4ff0-a7db-9ee622510094.jpg",
"Order":0,
"source": "integration",
"modified_date": "2022-11-25T12:06:42.954200Z",
"created_date": "2022-11-25T12:06:42.954186Z"
}
POST
Create Product Video
POST
Create Product VideoThis method is used to upload videos of products.
Path: /api/v1/product_video/
{
video: {File},
"product": {product_pk}
}
Response
{
"pk":1,
"product":1,
"video":"http://{customer_omnitron_url}/media/product_videos/2021/05/25/6befb990-b167-4fed-9a77-b8267503cb88.mp4",
"order":0,
"modified_date": "2022-07-05T05:36:03.865894Z",
"created_date": "2022-07-05T05:36:03.865865Z"
}
Response / 400
The following errors may occur if the payload of the POST request is not correct while creating an image on a product.
{
"product": [
"Incorrect type. Expected pk value, received unicode."
]
}
-- OR
{
"image": [
"Upload a valid image. The file you uploaded was either not an image or a corrupted image."
]
}
-- OR
{
"image": [
"No file was submitted."
]
}
PATCH
Update Product Image
PATCH
Update Product ImageThis method is used to change the order of the images uploaded for the product.
Path: /api/v1/product_image/{pk}/
{
"pk": 20029,
"order": 1
}
Response
{
"pk":20029,
"product":1,
"image":"http://{customer_omnitron_url}/media/products/2021/06/01/1/689df4bf-d549-45e2-aae8-f958ea357b7e.jpg",
"order":1
}
PATCH
Update Product Video
PATCH
Update Product VideoThis method is used to change the order of the videos uploaded for the product.
Path: /api/v1/product_video/{pk}/
{
"pk": 20129,
"order": 1
}
Response / 200
If the PATCH response is successful, it returns the following response.
{
"pk":20129,
"product":1,
"video":"http://{customer_omnitron_url}/media/products/2021/06/01/1/689df4bf-d549-45e2-aae8-f958ea357b7e.mp4",
"Order":1,
"source": null,
"modified_date": "2023-01-03T18:42:18.358380Z",
"created_date": "2022-11-25T12:06:42.954186Z"
}
Response / 400
Following errors may take place while updating an image on a product, if the payload of the PATCH request is not correct.
{
"order": [
"Ensure this value is greater than or equal to 0."#if order negative
]
}
DELETE
Product Image
DELETE
Product ImageThis method is used to delete the images uploaded for the product.
Path: /api/v1/product_image/{pk}/
Response
Returns HTTP204 if the DELETE request is successful. Related product image has been deleted.
DELETE
Product Video
DELETE
Product VideoThis method is used to delete the videos uploaded for the product.
Path: /api/v1/product_video/{pk}/
Response
Returns HTTP204 if the DELETE request is successful. Related product video has been deleted.
POST
Set the Main Image of a Product
POST
Set the Main Image of a ProductThis method is used to select the main image of the product.
Path: /api/v1/product_image/{pk}/make_special/
{
"_pk": 20028,
"special_image_type": "base",
"_detailed": "make_special"
}
Response
{
"special_image_type":"base"
}
Downloadable Image
This is the structure where the images in the ERP systems of the companies are downloaded and saved to the CDN and default storage with projects and media.
POST
Receive Images from ERP
POST
Receive Images from ERPThese methods allow the download of product images from the ERP system.
Path: /api/v1/downloadable_image/{product_pk}/download/
{
"url": # ERP file url
"image_type": #(default, swatch, picto)
"product": "<product_pk>"
"order": <int>,
"source": "integration",
"modified_date": "2017-01-23T08:33:56.794003Z",
"created_date": "2017-01-22T23:56:28.881838Z"
}
Response
HTTP200
Last updated
Was this helpful?