Adds images to an Image Search instance.

Before you call this operation, you must specify the instanceName parameter in the URL to specify the instance to which you want to add images. You must also specify other parameters in a specified format to construct the request body. The request URL includes /item/add.

Request parameters

  • Parameters in the URL
    Parameter Type Required Description
    instanceName String Yes The name of the Image Search instance to which you want to add images.
  • Parameters in the request body
    Parameter Type Required Description
    item_id String Yes The ID of the product or the image.
    cat_id String
    • For product image searches, this parameter is required.
    • For generic image searches, this parameter is optional.
    The ID of the category.
    crop boolean No Specifies whether to recognize the subject in the image and search for images based on the recognized subject. Valid values: true and false. Default value: true.
    region String No The subject area in the image. The subject area is in the format of x1,x2,y1,y2. x1 and y1 represent the upper-left corner pixel. x2 and y2 represent the lower-right pixel. By default, the system automatically recognizes the subject area.
    cust_content String Yes The user-defined content.
    pic_list List Yes The list of image names.
    pic_map Map Yes The content of each image.
  • Body structure
    The body is in the following format:

    The body is divided into two parts: image metadata and image content, which are separated with a circumflex (^). The metadata includes a set of keys and the offset of each key value in the content. Keys are separated with number signs (#). Each key includes a key name, a start offset value, and an end offset value, which are separated with commas (,). The start offset value and the end offset value represent the start position and end position of the key the image content. The pic_list parameter specifies Base64-encoded images names that are separated with commas (,). The pic_map parameter specifies Base64-encoded image content. Each key that is specified in the pic_map parameter must be paired with a key that is specified in the pic_list parameter.

Response parameters

Parameter Type Description
Success Boolean Indicates whether the request is successful.
RequestId String The ID of the request.
Code int The error code. The value 0 indicates a request success. A value that is not 0 indicates a request failure.
Message String The returned message.

Response format

{ "Message":"success", "RequestId":"73B5133C-84EE-4F0A-B972-23CCCBFB7CD5", "Success":true, "Code":0 }


The following example shows how to add a product image to the Image Search instance named goodssearch. In this example, the value of the item_id parameter is 1000. The value of the cat_id parameter is 0. The value of the cust_content parameter is {"key1":"value1"}. Product images shoes1.jpg and shoes2.jpg are added. The content of the shoes1.jpg image is pic_content1, and the content of the shoes2.jpg image is pic_content2. The following request is provided:
URL: /item/add? instaneName=goodssearch
POST Body:
Note: c2hvZXMyLmpwZw== represents the Base64-encoded image name shoes1.jpg and c2hvZXMxLmpwZw== represents the Base64-encoded image name shoes2.jpg.