Querying the Open Port List of a Single Server
Function
This API is used to query the open port list of a single server.
Authorization Information
Each account has all the permissions required to call all APIs, but IAM users must be assigned the required permissions.
- If you are using role/policy-based authorization, see Permissions Policies and Supported Actions for details on the required permissions.
- If you are using identity policy-based authorization, no identity policy-based permission required for calling this API.
URI
GET /v5/{project_id}/asset/ports
Parameter | Mandatory | Type | Description |
|---|---|---|---|
project_id | Yes | String | Definition Project ID, which is used to specify the project that an asset belongs to. After the project ID is configured, you can query assets in the project using the project ID. For details about how to obtain it, see Obtaining a Project ID. Constraints N/A Range The value can contain 1 to 256 characters. Default Value N/A |
Parameter | Mandatory | Type | Description |
|---|---|---|---|
host_id | Yes | String | Definition Server ID. Constraints N/A Range The value can contain 0 to 128 characters. Default Value N/A |
host_name | No | String | Definition Server name. Constraints N/A Range The value can contain 0 to 128 characters. Default Value N/A |
host_ip | No | String | Definition Server IP address. Constraints N/A Range The value can contain 0 to 128 characters. Default Value N/A |
port | No | Integer | Definition Port number. Constraints N/A Range Minimum value: 1. Maximum value: 65535. Default Value N/A |
type | No | String | Definition Port type. It can be TCP or UDP. Constraints N/A Range Default Value N/A |
status | No | String | Definition Port Status Constraints N/A Range Default Value N/A |
enterprise_project_id | No | String | Definition ID of the enterprise project that the server belongs to. The default value of an enterprise project ID is 0, indicating the default enterprise project. To query servers in all enterprise projects, set this parameter to all_granted_eps. If you only have the permissions for a specific enterprise project, to query a server in the project, specify the enterprise project ID. Otherwise, an error will be reported due to insufficient permission. Constraints An enterprise project can be configured only after the enterprise project function is enabled. Range The value can contain 0 to 256 characters. Default Value 0 |
limit | No | Integer | Definition Number of records displayed on each page. Constraints N/A Range Value range: 10-200 Default Value 10 |
offset | No | Integer | Definition Offset, which specifies the start position of the record to be returned. Constraints N/A Range The value range is 0 to 2,000,000. Default Value The default value is 0. |
category | No | String | Definition Type. The default value is host. Constraints N/A Range Default Value host |
Request Parameters
Parameter | Mandatory | Type | Description |
|---|---|---|---|
X-Auth-Token | Yes | String | Definition User token, which contains user identity and permissions. The token can be used for identity authentication when an API is called. For details about how to obtain the token, see Obtaining a User Token. Constraints N/A Range The value can contain 1 to 32,768 characters. Default Value N/A |
Response Parameters
Status code: 200
Parameter | Type | Description |
|---|---|---|
total_num | Integer | Definition Number of open ports. Range The value range is 0 to 10,000. |
data_list | Array of PortResponseInfo objects | Definition Port information list. Range N/A |
Parameter | Type | Description |
|---|---|---|
host_id | String | Definition Server ID. Range The value can contain 1 to 128 characters. |
laddr | String | Definition Listening IP address. Range The value can contain 1 to 128 characters. |
status | String | Definition Port status. Range |
port | Integer | Definition Port number. Range The value ranges from 0 to 65,535. |
type | String | Definition Port type. It can be TCP or UDP. Range |
pid | Integer | Definition Process ID. Range Minimum value: 1. Maximum value: 65535. |
path | String | Definition Path of the executable file of a process. Range The value can contain 1 to 256 characters. |
agent_id | String | Definition Agent ID Range The value can contain 1 to 64 characters. |
container_id | String | Definition Container ID Range Length: 0 to 128 characters |
Example Requests
The first 10 open ports whose host_id is dd91cd32-a238-4c0e-bc01-3b11653714ac are queried by default.
GET https://{endpoint}/v5/{project_id}/asset/ports?hlimit=10&offset=0&host_id=dd91cd32-a238-4c0e-bc01-3b11653714ac Example Responses
Status code: 200
Request succeeded.
{
"data_list" : [ {
"agent_id" : "eb5d03f02fffd85aaf5d0ba5c992d97713244f420e0b076dcf6ae0574c78aa4b",
"container_id" : "",
"host_id" : "dd91cd32-a238-4c0e-bc01-3b11653714ac",
"laddr" : "0.0.0.0",
"path" : "/usr/sbin/dhclient",
"pid" : 1507,
"port" : 68,
"status" : "unknow",
"type" : "UDP"
}, {
"agent_id" : "eb5d03f02fffd85aaf5d0ba5c992d97713244f420e0b076dcf6ae0574c78aa4b",
"container_id" : "",
"host_id" : "dd91cd32-a238-4c0e-bc01-3b11653714ac",
"laddr" : "127.0.0.1",
"path" : "/usr/sbin/chronyd",
"pid" : 493,
"port" : 323,
"status" : "unknow",
"type" : "UDP"
} ],
"total_num" : 2
} Status Codes
Status Code | Description |
|---|---|
200 | Request succeeded. |
Error Codes
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
