Resolve Host IDs

GET/pcrs/1.0/posture/hostids?policyId=policyId1, policyId2

List all Host IDs for the specified policies.

For the Resolve Host IDs API, you must use the token that is returned by the authentication request. You can include a maximum of 10 policies in one API request.

Input ParametersInput Parameters

Parameter

Required/Optional

Data Type

Description

policyId

Required

Integer 

Policy IDs for compliance evaluation.

Request header:

Authorization

Required

String 

JWT encrypted token.

Note: Provide the token received from the Authorization API as the input.

lastScanDate

Optional

Integer 

Get host IDs based on the specified date on which they were last scanned.

The formats for date are:

lastScanDate=YYYY-MM-DD

For example:

lastScanDate=2022-05-25

Or,

lastScanDate=2022-05-25T18:48:16Z

Sample - JSON Output Response - Resolve Host IDsSample - JSON Output Response - Resolve Host IDs

Resolve Host IDs With Single Policy ID

API Request

curl -X GET https://<qualys_base_url>/pcrs/1.0/posture/hostids?policyId=POLICY ID-H "accept:*/*"-H "Authorization: Bearer token"

JSON Output

[
{
"policyId": "<POLICY ID>",
"subscriptionId": "SUBSCRIPTION ID",
"hostIds": [
"<HOST ID>"
]
}
]

Resolve Host IDs With Multiple Policy IDs

API Request

curl -X GET https://<qualys_base_url>/pcrs/1.0/posture/hostids?policyId=xxx,xxx-H "accept: */*"-H"Authorization: Bearer token"

JSON Output

[
{
"policyId": "<POLICY ID>",
"subscriptionId": "<SUBSCRIPTION ID>",
"hostIds": [
"<HOST ID>"
]
},
{
"policyId": "<POLICY ID>",
"subscriptionId": "SUBSCRIPTION ID",
"hostIds": [
"<HOST ID>"
]
}
]

Resolve Host IDs Based on the Specified Last Scan Date

API Request

curl -X GET https://<qualys_base_url>/pcrs/1.0/posture/hostids?policyId=4677689&lastScanDate=2022-05-25-H "accept: */*"-H"Authorization: token"

JSON Output

[
    {
        "policyId": "4677689",
        "subscriptionId": "<SUBSCRIPTION ID>",
        "hostIds": [
            "<HOST ID 1>",
            "<HOST ID 2>",
            "<HOST ID 3>",
            "<HOST ID 4>",
            "<HOST ID 5>",
        ]
    }
]

Related Topics

PC Posture Streaming APIs

Get Policy IDs

Get Posture Info