Querying an Image
Function
You can use the API to check whether an image exists in the image library with the image path.
URI
POST /v1/{project_id}/{instance_name}/image/check
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
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. |
Name |
Mandatory |
Type |
Description |
---|---|---|---|
path |
No |
String |
Image URL, which is used as the ID of an image in the image library |
Response Parameters
Status code: 200
Name |
Type |
Description |
---|---|---|
exist |
String |
Calling result when the API call succeeds. This parameter is not included when the API fails to be called. The value can be true or false. The default value is false.
|
Status code: 400
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
Query an image in the index library based on the image path (https://bucketName.obs.myhuaweicloud.com/image/test1.jpg).
POST https://{endpoint}/v1/{project_id}/{instance_name}/image/check { "path" : "https://bucketName.obs.myhuaweicloud.com/image/test1.jpg" }
Example Response
Status code: 200
Example of a successful response
{ "exist" : "true" }
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.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot