Created by potrace 1.16, written by Peter Selinger 2001-2019

Miva Developer Docs

Adds an image to the store.


Adds an image to the store. Point it at an image file that’s already on the server, or send the image as base64 data and it creates the file for you. To attach an image to a product, use ProductImage_Add.

Before you begin#

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.

Example requests#

Add an image that’s on the server#

Adds the image file already uploaded to graphics/00000001/logo-min.png.

{
    "Store_Code": "{{Store_Code}}",
    "Miva_Request_Timestamp": "{{$timestamp}}",
    "Function": "Image_Add",
    "Filepath": "graphics/00000001/logo-min.png"
}

Add a base64 encoded image#

Creates the image file at Filepath from the base64 data in Image_Data.

{
    "Store_Code": "{{Store_Code}}",
    "Miva_Request_Timestamp": "{{$timestamp}}",
    "Function": "Image_Add",
    "Filepath": "graphics/00000001/NEW.jpg",
    "Image_Data": "ADD_BASE64_IMAGE_HERE"
}

Request parameters#

Parameter Type Description
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.
Image_Data String Optional. A base64 encoded image. When provided, the image file will be created from this data at the specified Filepath.

Example response#

{
    "success": 1
}

Response parameters#

Parameter Type Description
success Boolean Boolean value for if the request was successful

Error responses#

Error Code Error Message Error Description
MER-JSN-IMG-00009 Invalid image extension The file extension of the provided Filepath is not valid.
MER-DBE-IMG-00001 Image filepaths must be local and relative to the Base Directory for Graphics Filepath is not a local relative path.
Function Use it to
ProductImage_Add Add an image to a product
ProductImage_Delete Remove an image from a product
ProductImage_Update_Type Change the image type of a product image
ImageTypeList_Load_Query List the store’s image types

Try in Postman#

This function isn’t in the Miva Postman collection yet. See Set Up Postman to send it with your own request.