Get List of Asset IDs
Use the this API to retrieve asset IDs without fetching complete asset details. You can retrieve the IDs of all assets in your inventory or apply filters to retrieve only the IDs of assets that match your criteria.
The API returns up to 9,950 asset IDs in a single request.
After retrieving the asset IDs, use the Get Host Details of All Assets API to fetch complete details for the selected assets.
Input ParametersInput Parameters
| Parameter | Mandatory/ Optional |
Data Type | Description |
|---|---|---|---|
| Authorization | Mandatory | string | Authorization token to authenticate. |
| filter | Optional | string | Filter the asset IDs in the response by providing filter criteria in JSON or XML format in the request body. If you do not specify a filter, the API returns the IDs of all assets in your inventory. |
| lastSeenAssetId | Optional | long | The ID of the last asset returned in the previous response. Use this parameter to get the next set of asset IDs.
When the hasMore value in the response is 1, pass the lastSeenAssetId value from that response in your next request. |
| assetLastUpdated | Optional | string | Get the IDs of assets updated on or after this date. Specify the date in UTC format: yyyy-MM-ddTHH:mmZ. |
| pageSize | Optional | integer | The number of asset IDs to include in the response. The default and maximum value is 9950. |
| assetCategory | Optional | string | The category of assets to fetch. The default value is All. |
Sample - Get the IDs of All Assets in Your InventorySample - Get the IDs of All Assets in Your Inventory
API Request
curl -X POST
'<qualys_base_url>/rest/2.0/search/am/asset/ids'
--header 'Authorization: Bearer <JWT Token>'
--header 'Content-Type: application/json'
Response
{
"responseMessage": "Valid API Access",
"count": 9950,
"responseCode": "SUCCESS",
"lastSeenAssetId": 23456,
"hasMore": 1,
"assetIds": [
10001,
10002,
...
23456
]
}
Sample - Get the IDs of Assets that Match a Filter (JSON)Sample - Get the IDs of Assets that Match a Filter (JSON)
API Request
curl -X POST
'<qualys_base_url>/rest/2.0/search/am/asset/ids?pageSize=3'
--header 'Authorization: Bearer <JWT Token>'
--header 'Content-Type: application/json'
--data '{
"filters": [
{
"field": "operatingSystem.category1",
"operator": "EQUALS",
"value": "Windows"
}
]
}'
Response
{
"responseMessage": "Valid API Access",
"count": 3,
"responseCode": "SUCCESS",
"lastSeenAssetId": 12345,
"hasMore": 1,
"assetIds": [
12301,
12302,
12345
]
}
Sample - Get the IDs of Assets that Match a Filter (XML)Sample - Get the IDs of Assets that Match a Filter (XML)
API Request
curl -X POST
'<qualys_base_url>/rest/2.0/search/am/asset/ids?pageSize=3'
--header 'Authorization: Bearer <JWT Token>'
--header 'Content-Type: application/xml'
--data '<FilterRequest>
<filters>
<Criteria field="operatingSystem.category1" operator="EQUALS">
<value>Windows</value>
</Criteria>
</filters>
</FilterRequest>'
Response
{
"responseMessage": "Valid API Access",
"count": 3,
"responseCode": "SUCCESS",
"lastSeenAssetId": 12345,
"hasMore": 1,
"assetIds": [
12301,
12302,
12345
]
}
Sample - Get the Next Set of Asset IDs using "lastSeenAssetId"Sample - Get the Next Set of Asset IDs using "lastSeenAssetId"
API Request
curl -X POST
'<qualys_base_url>/rest/2.0/search/am/asset/ids?lastSeenAssetId=12345&pageSize=3'
--header 'Authorization: Bearer <JWT Token>'
--header 'Content-Type: application/json'
--data '{
"filters": [
{
"field": "operatingSystem.category1",
"operator": "EQUALS",
"value": "Windows"
}
]
}'
Response
{
"responseMessage": "Valid API Access",
"count": 2,
"responseCode": "SUCCESS",
"lastSeenAssetId": 12410,
"hasMore": 0,
"assetIds": [
12398,
12410
]
}
Response CodesResponse Codes
|
Code |
Description |
|---|---|
| 200 | SUCCESS: The request was processed successfully. |
| 204 | NO_CONTENT: No assets are found, or no assets match the filter criteria. |
| 400 | The request syntax is not valid. |
| 416 | Requested Range Not Satisfiable: The pageSize value is outside the supported range of 1 to 9950. |
| 500 | The server encountered an unexpected error. |