ProductImage_Add#
Description#
This function allows you to add a new image to a product.
Note
The file must first exist on the server at the path specified before calling this function, unless a base64 encoded image is supplied via the optional Image_Data parameter. Use FTP to upload the file to the server or the Miva admin.
Request Body Parameters#
| Parameter | Type | Description |
|---|---|---|
product_idEdit_ProductProduct_CodeProduct_SKU |
Number String String String |
ID Number of product Product code string Product code string Product SKU string |
Filepath |
String | Relative file path to the image (relative to mm5 folder). The file must already exist on the server, unless Image_Data is provided. |
ImageType_ID |
Number | The Id of the Image type you want to assign to the image. Pass 0 to not assign an image type. |
Image_Data |
String | Optional. A base64 encoded image. When provided, the image file will be created from this data at the specified Filepath. |
Response Parameters#
| Parameter | Type | Description |
|---|---|---|
success |
Boolean | Boolean value for if the request was successful |
Example Request#
{
"Store_Code": "{{Store_Code}}",
"Miva_Request_Timestamp": "{{$timestamp}}",
"Function": "ProductImage_Add",
"Product_ID": 1,
"Filepath": "graphics/00000001/logo-min.png",
"ImageType_ID": 1
}
Example Response#
{
"success": 1
}
base64 encoded#
Example Request#
{
"Store_Code": "{{Store_Code}}",
"Miva_Request_Timestamp": "{{$timestamp}}",
"Function": "ProductImage_Add",
"Product_ID": 1,
"Filepath": "graphics/00000001/NEW.jpg",
"ImageType_ID": 1,
"Image_Data": "ADD_BASE64_IMAGE_HERE"
}
Error Responses#
| Error Code | Error Message | Error Description |
|---|---|---|
| MER-DBE-IMG-00001 | Image filepaths must be local and relative to the Base Directory for Graphics | Order number not found. |
| EOF | Record not found: MER-DBP-PRD-00017 | Product ID not found |