Batch Querying Instances
Function
This API is used to batch query instances.
Calling Method
For details, see Calling APIs.
URI
GET /v1/{project_id}/instances
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
project_id |
Yes |
String |
Definition The project ID. Constraints N/A Range The project ID of the account Default Value N/A |
Request Parameters
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
X-Auth-Token |
Yes |
String |
Definition Requests for calling an API can be authenticated using a token. If token-based authentication is used, this parameter is mandatory and must be set to a user token. Constraints N/A Range N/A Default Value N/A |
Response Parameters
Status code: 200
Parameter |
Type |
Description |
---|---|---|
instances |
Array of QueryInstanceResponseBody objects |
Instance list. |
page_info |
PageInfo object |
Definition Pagination information. Constraints N/A |
count |
Integer |
The total number of instances. |
Parameter |
Type |
Description |
---|---|---|
id |
String |
Definition Instance ID. Constraints N/A Range N/A Default Value N/A |
name |
String |
Definition Instance name. Constraints N/A Range N/A Default Value N/A |
vpc_id |
String |
Definition ID of the VPC which the network interface to be created belongs to. You can query the ID using the VPC API: https://support.huaweicloud.com/intl/en-us/api-vpc/vpc_api01_0003.html Constraints N/A Range VPC ID Default Value N/A |
network_interfaces |
Array of NetworkInterface objects |
Definition Network interface information about an iMetal server. Constraints An iMetal server can contain a maximum of two network interfaces, and the first one serves as the primary network interface. If multiple network interfaces are specified, ensure that all network interfaces belong to the same VPC. |
tags |
Array of Tag objects |
Definition Tag. Constraints N/A |
image |
Image object |
Definition Server image information. Constraints N/A |
description |
String |
Definition Description of the cloud server. Constraints N/A Range N/A Default Value Empty string |
state |
String |
Definition Instance status. Constraints N/A Range
Default Value N/A |
metadata |
Table 9 object |
- |
user_data |
String |
Definition Custom user data to be injected into the instance during instance creation. Constraints N/A Range The content of user_data must be encoded with base64. The maximum size of the content to be injected (before encoding) is 32 KB. Default Value N/A |
server_id |
String |
Definition Server ID. Constraints N/A Range Its value is in UUID format. Default Value N/A |
created_at |
String |
Definition Creation time. Constraints N/A Range The value is in RFC 3339 format, for example, 2025-04-22T12:03:18.50083+08:00. Default Value N/A |
updated_at |
String |
Definition Update time. Constraints N/A Range The value is in RFC 3339 format, for example, 2025-04-22T12:03:18.50083+08:00. Default Value N/A |
launched_at |
String |
Definition Start time. Constraints N/A Range The value is in RFC 3339 format, for example, 2025-04-22T12:03:18.50083+08:00. Default Value N/A |
error |
ErrorStatus object |
Definition Error object returned upon a failure. Constraints N/A |
Parameter |
Type |
Description |
---|---|---|
subnet_id |
String |
Definition subnet id Constraints N/A Range N/A Default Value N/A |
ipv4_address |
String |
Definition Private IPv4 address of an elastic network interface. Constraints N/A Range N/A Default Value N/A |
Parameter |
Type |
Description |
---|---|---|
id |
String |
Definition Image ID. Constraints N/A Range The value is in UUID format. Default Value N/A |
name |
String |
Definition Image name. Constraints N/A Range N/A Default Value N/A |
os_type |
String |
Definition Image OS type. Constraints N/A Range Default Value N/A |
Parameter |
Type |
Description |
---|---|---|
{Custom key} |
Map<String,String> |
Definition Metadata for creating an iMetal instance. You can use metadata to customize key-value pairs. If the metadata contains sensitive data, take appropriate measures to protect the sensitive data, for example, controlling access permissions and encrypting the data. Constraints N/A Range A maximum of 10 key-value pairs can be injected. A metadata key consists of 1 to 255 characters and contains only uppercase letters, lowercase letters, spaces, digits, hyphens (-), underscores (_), colons (:), and decimal points (.). A metadata value consists of a maximum of 255 characters. Default Value N/A |
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Definition Error code. Constraints N/A Range N/A Default Value N/A |
error_msg |
String |
Definition Error message. Constraints N/A Range N/A Default Value N/A |
error_type |
String |
Definition Error type. Constraints N/A Range Default Value N/A |
Parameter |
Type |
Description |
---|---|---|
next_marker |
String |
Definition Query address of the next page. Constraints N/A Range N/A Default Value N/A |
previous_marker |
String |
Definition Query address of the previous page. Constraints N/A Range N/A Default Value N/A |
current_count |
Integer |
Definition The number of items returned on this page. Constraints N/A Range N/A Default Value N/A |
Status code: 400
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Definition Error code. Constraints N/A Range N/A Default Value N/A |
error_msg |
String |
Definition Error message. Constraints N/A Range N/A Default Value N/A |
Status code: 401
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Definition Error code. Constraints N/A Range N/A Default Value N/A |
error_msg |
String |
Definition Error message. Constraints N/A Range N/A Default Value N/A |
Status code: 429
Parameter |
Type |
Description |
---|---|---|
- |
String |
- |
Status code: 500
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Definition Error code. Constraints N/A Range N/A Default Value N/A |
error_msg |
String |
Definition Error message. Constraints N/A Range N/A Default Value N/A |
Example Requests
Request for batch querying instances
GET https://{endpoint}/v1/{project_id}/instances
Example Responses
Status code: 200
The instance list is displayed by page.
{ "instances" : [ { "id" : "0195f996-79c5-7d34-a98e-3a96f7926d96", "name" : "host-0403-199", "vpc_id" : "31434907-0817-4acc-9a59-c44cf157303b", "network_interfaces" : [ { "subnet_id" : "", "ipv4_address" : "192.168.27.57" } ], "image" : { "id" : "e66a19b0-8c94-4b03-9f4d-4fbd676bcbf0", "name" : "test-lsy\nUbuntu 22.04 server 64bit", "os_type" : "Linux" }, "description" : "", "state" : "terminated", "user_data" : "", "server_id" : "0195f996-79c5-7d34-a98e-3a96f7926d96", "created_at" : "", "updated_at" : "2025-07-11T17:07:05+08:00", "launched_at" : "2025-04-03T10:59:03+08:00", "error" : { "error_code" : "iMetal.0099", "error_msg" : "failed to reinstall os, create reinstall job on Jarvis failed", "error_type" : "reinstall_error" } } ], "page_info" : { "next_marker" : "01981672-2e82-7d8a-a315-3f686155a815", "previous_marker" : "", "current_count" : 92 }, "count" : 92 }
Status Codes
Status Code |
Description |
---|---|
200 |
The instance list is displayed by page. |
400 |
Invalid request parameter. |
401 |
The request is not authenticated. |
429 |
The request is overloaded. |
500 |
Internal server error. |
Error Codes
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