Help Center/ ImageSearch/ API Reference/ APIs/ Modifying Image Information
Updated on 2023-12-13 GMT+08:00

Modifying Image Information

Function

You can use the API to modify the information about an existing image in the image library.

URI

PUT /v1/{project_id}/{instance_name}/image
Table 1 Path parameters

Name

Mandatory

Type

Description

instance_name

Yes

String

Instance name

project_id

Yes

String

Project ID. See Obtaining a Project ID and Name.

Request Message

Table 2 Request header parameters

Name

Mandatory

Type

Description

X-Auth-Token

Yes

String

User token

Used to obtain the permission to call APIs. For details about how to obtain the token, see Authentication. The value of X-Subject-Token in the response header is the token.

Table 3 Request body parameters

Name

Mandatory

Type

Description

path

Yes

String

Image URL, which is used as the ID of an image in the image library

tags

Yes

Object

Custom image tag. The tags are key-value pairs.

  • The tag name (key) must exist in the instance.
  • The tag content (value) is a custom value.

Response Parameters

Status code: 200

Table 4 Response body parameter

Name

Type

Description

result

String

Calling result when the API call succeeds. This parameter is not included when the API fails to be called.

Status code: 400

Table 5 Response body parameter

Name

Type

Description

error_code

String

Error code of a failed API call. For details, see Error Codes.

This parameter is not included when the API is successfully called.

error_msg

String

Error message when the API call fails.

This parameter is not included when the API is successfully called.

Example Requests

Enter an image path, set a custom label, and modify information about an existing image in the image index library.

PUT https://{endpoint}/v1/{project_id}/{instance_name}/image

{
  "path" : "https://bucketName.obs.myhuaweicloud.com/image/test1.jpg",
  "tags" : {
    "test-tags" : "test-image"
  }
}

Example Response

Status code: 200

Example of a successful response

{
  "result" : "Success"
}

Status code: 400

Example of a failed response

{
  "error_code" : "IS.0003",
  "error_msg" : "Arguments of path can not be null."
}

Status Code

Status Code

Description

200

Successful response

400

Failed response

Error Code

For details, see Error Codes.