Resolve Host IDs

For API version information, refer to the API Version History section.

V1.0| V2.0| V3.0

The V3 API is designed to fetch only PC Asset data. To retrieve both PC and SCA Asset data, continue using API Versions V1 or V2.

V 1.0

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 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={value}

Required

Integer 

The ID of the policy for which you want to resolve hosts.  You can specify a single policy or multiple/all the policies in your subscription using comma-separated values.

Request header:

Authorization

Required

String 

JWT encrypted .

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

lastScanDate={value}

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 -  Resolve Host IDsSample -  Resolve Host IDs

Resolve Host IDs With Single Policy ID

API Request

curl -X GET https://<qualys_base_url>/pcrs/2.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 "

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: "

JSON Output

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

V 2.0

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

List all Host IDs for the specified policies.

For the Resolve Host IDs API, you must use the 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={value}

Required

Integer  The ID of the policy for which you want to resolve hosts. You can specify a single policy or multiple/all the policies in your subscription using comma-separated values.

Request header:

Authorization

Required

String 

JWT encrypted .

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

lastScanDate={value}

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 -  Resolve Host IDsSample -  Resolve Host IDs

Resolve Host IDs With Single Policy ID

API Request

curl -X GET https://<qualys_base_url>/pcrs/2.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/2.0/posture/hostids?policyId=xxx,xxx-H "accept: */*"-H"Authorization: Bearer "

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/2.0/posture/hostids?policyId=4677689&lastScanDate=2022-05-25-H "accept: */*"-H"Authorization: "

JSON Output

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

V 3.0

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

The V3 API is designed to fetch only PC Asset data. To retrieve both PC and SCA Asset data, continue using API Versions V1 or V2.

This new version (/pcrs/3.0/posture/hostids) of this API enables to resolve hostIDs :

Important to know

Input ParametersInput Parameters

Parameter

Required/Optional

Data Type

Description

policyId={value}

Optional

Integer 

The ID of the policy for which you want to resolve hosts. You can specify a single policy or multiple/all the policies in your subscription using comma-separated values.

If no Policy ID is provided in the API request, then the hosts are resolved for all the policies in the subscription.

Request header:

Authorization

Required

String 

JWT encrypted .

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

lastScanDate={value}

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

statusChangedSince={value} Optional Date Specify the date to resolve the hosts with posture modified (failed or passed ) on or after the specified date.

Sample - Resolve Host IDsSample - Resolve Host IDs

Resolve Host IDs With Single Policy ID

API Request

curl -X GET https://<qualys_base_url>/pcrs/3.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/3.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/3.0/posture/hostids?policyId=4677689&lastScanDate=2022-05-25-H "accept: */*"-H"Authorization:Bearer Token "

JSON Output

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

Sample- Resolve hostIDs based on the specific posture modification dateSample- Resolve hostIDs based on the specific posture modification date

API Request

curl -X GET https://gateway/pcrs/3.0/posture/hostids?policyId=<Policy_ID>& statusChangedSince= <Date>
-H "accept: */*" -H "Authorization: Bearer Token" 

JSON Output

[
    {
        "policyId": <Policy_ID>,
        "subscriptionId": <Subscription_id>,
        "hostIds": [
            <Host_IDs>,
            <Host_IDs>,
            <Host_IDs>,
        ]
    }
]

 

API Version History

The following table depicts the information about the different versions of this API along with the status:

API Version API Status Release Date
 /pcrs/1.0/posture/hostids? To be deprecated March 2025
 /pcrs/2.0/posture/hostids? To be deprecated May 2025
 /pcrs/3.0/posture/hostids? Active November 2024

Related Topics

PC Posture Streaming APIs

Get Policy IDs

Get Posture Info


 

 

Was this topic helpful?

success Thank you! We're glad to hear that this topic was useful.
success We appreciate your feedback. We'll work to make this topic better for you in the future.