nav-img
Advanced

Querying the List of Servers Corresponding to a Vulnerability Scan Task

Function

This API is used to query the list of servers corresponding to a vulnerability scan task.

URI

GET /v5/{project_id}/vulnerability/scan-task/{task_id}/hosts

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID.

task_id

Yes

String

Task ID

Table 2 Query Parameters

Parameter

Mandatory

Type

Description

enterprise_project_id

No

String

Enterprise user ID. To query all enterprise projects, set this parameter to all_granted_eps.

limit

No

Integer

Number of records displayed on each page.

offset

No

Integer

Offset, which specifies the start position of the record to be returned.

scan_status

No

String

Scan status of the server. The options are as follows:

  • scanning

  • success

  • failed

Request Parameters

Table 3 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

User token.

It can be obtained by calling an IAM API. The value of X-Subject-Token in the response header is the user token.

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

total_num

Long

Total number

data_list

Array of VulScanTaskHostInfo objects

Indicates the list of servers corresponding to a vulnerability scan task.

Table 5 VulScanTaskHostInfo

Parameter

Type

Description

host_id

String

Server ID

host_name

String

Server name

public_ip

String

EIP

private_ip

String

Private IP address

asset_value

String

Asset importance. The options are as follows:

  • important

  • common

  • test

scan_status

String

Scan status of the server. The options are as follows:

-scanning

-success

-failed:

failed_reasons

Array of failed_reasons objects

List of scan failure causes

Table 6 failed_reasons

Parameter

Type

Description

vul_type

String

Operation type. The options are as follows:

-linux_vul: Linux vulnerability

-windows_vul: Windows vulnerability

-web_cms: Web-CMS vulnerability

-app_vul: application vulnerability

-urgent_vul: emergency vulnerability

failed_reason

String

Cause of the scanning failure.

Example Requests

This API is used to query details of vulnerability scan task whose ID is 2b31ed520xxxxxxebedb6e57xxxxxxxx. The list of failed servers and failure causes are displayed. By default, 10 servers on the first page are queried.

GET https://{endpoint}/v5/{project_id}/vulnerability/scan-task/{task_id}/hosts?offset=0&limit=10&scan_status=failed&enterprise_project_id=XXX
{
"scan_status" : "failed",
"task_id" : "2b31ed520xxxxxxebedb6e57xxxxxxxx"
}

Example Responses

Status code: 200

Request succeeded.

{
"total_num" : 1,
"data_list" : [ {
"host_id" : "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"host_name" : "ecs-ubuntu-abc123",
"public_ip" : "112.10.10.3",
"private_ip" : "192.168.10.1",
"asset_value" : "important",
"scan_status" : "failed",
"failed_reasons" : [ {
"vul_type" : "linux_vul",
"failed_reason" : "this_is_failed_reason"
} ]
} ]
}

Status Codes

Status Code

Description

200

Request succeeded.

Error Codes