List Asset Jobs API
The asset job is created per asset when a script is executed on it.
If you want to include script result in the response, you can set the ’includeScriptResult’ variable to ’True’.
Input ParametersInput Parameters
|
Parameter |
Mandatory/Optional |
Data Type |
Description |
|---|---|---|---|
|
startAt/endAt |
No |
string |
Filter jobs based on the time when a job is generated (dateTime) or based on the time when a job is processed at Qualys (processedTime). |
|
Filter |
No |
string |
Filter the asset jobs by providing a query using Qualys syntax. Refer to the “How to Search” topic in the online help for assistance with creating your query. For example – "filter": "job.id:<JOB ID>" |
|
includeScriptResult |
No |
string |
This flag can be set to ’true’ if you want the script output to be fetched in the response. Note: The script result will be fetched in Base 64 encoded format. You must decode it to view the result.
|
|
pageNumber |
No |
string |
The page to be returned. Starts from zero. |
API Request
"curl --location --request POST""https://<qualys_base_url>/sm/v1/assetjobs/search""\\
--header""Content-Type: application/json""\\
--header""Authorization: Bearer <authToken>""\\
--data-raw""
{
\"filter\":\"job.id:80507\",
\"includeScriptResult\": true,
\"sort\": \"[{\"created.dateTime\":\"desc\"}]\"
}"
Request Body
Search job details with job ID:
{
"filter": "job.id:80507",
"includeScriptResult": true,
"sort": "[{\"created.dateTime\":\"desc\"}]"
}
Response
"i) Response with the ’IncludeScriptResult’ variable set to ’true’":"Note":"The""scriptResult"is in base64-encoded format.{
" ""errorCode":null,
" ""message":null,
" ""body":{
" ""totalCount":1,
" ""list":[
" "{
" ""output":{
" ""code":0,
" ""text":"SUCCESS"" "
},
" ""customerUuid":"<CUSTOMER UUID>",
" ""enddate":"2022-05-11T06:42:13.692+00:00",
" ""test":false,
" ""isTest":false,
" ""scriptResult":"U2hlbGwgU2NyaXB0IE91dHB1dCBwcmludGVkISEK",
" ""created":{
" ""dateTime":1652251134952
},
" ""id":"80541",
" ""job":{
" ""scriptId":"<SCRIPT ID>",
" ""scriptType":"Shell",
" ""scriptSeverity":1,
" ""scriptName":"<SCRIPT NAME>",
" ""correlationUuid":"<CORRELATION UUID>",
" ""id":80014,
" ""platform":"LINUX",
" ""scriptCategory":"Data Backup"" "
},
" ""asset":{
" ""address":"<ASSET IP>",
" ""name":"sm-pc-test-Linux-vm2",
" ""id":20452610,
" ""agentUuid":"<AGENT UUID>",
" ""operatingSystem":"CentOS Linux 7.9.2009",
" ""tags":[
" "{
" ""name":"Cloud Agent",
" ""tagUuid":"<TAG UUID>",
" ""id":102909758
},
" "{
" ""name":"Test tag",
" ""tagUuid":"<TAG UUID>",
" ""id":112278818
},
" "{
" ""name":"SM 1.0 test tag",
" ""tagUuid":"<TAG UUID>",
" ""id":120198213
},
" "{
" ""name":"SM_Tag_Test",
" ""tagUuid":"<TAG UUID>",
" ""id":119295749
},
" "{
" ""name":"PostgreSQL",
" ""tagUuid":"<TAG UUID>",
" ""id":112207922
},
" "{
" ""name":"testBU3",
" ""tagUuid":"<TAG UUID>",
" ""id":103100188
},
" "{
" ""name":"testBU",
" ""tagUuid":"<TAG UUID>",
" ""id":34781853
},
" "{
" ""name":"SM""<TAG UUID>"",
""id"": 119082623
},
{
""name"": "SM 1.1 Tag Test",
""tagUuid"": ""<TAG UUID>"",
""id"": 122379045
}
]
},
""manifestId"": "c202ab1e-3fbe-46ec-8e28-52f644098880",
""status"": ""SUCCESS""\"
}
]
}
}"
To know the details of the response codes, refer to Appendix.
The ‘searchAfter’ parameter is supported for the following API:
Input ParametersInput Parameters
|
Parameter |
Mandatory/Optional |
Data Type |
Description |
|---|---|---|---|
|
startAt/endAt |
No |
string |
Filter jobs based on the time when a job is generated (dateTime) or based on the time when a job is processed at Qualys (processedTime). |
|
Filter |
No |
string |
Filter the asset jobs by providing a query using Qualys syntax. Refer to the “How to Search” topic in the online help for assistance with creating your query. For example – "filter": " |
|
includeScriptResult |
No |
string |
This flag can be set to ’true’ if you want the script output to be fetched in the response. Note: The script result will be fetched in Base 64 encoded format. You must decode it to view the result.
|
|
pageNumber |
No |
string |
The page to be returned. Starts from zero. |
|
sort |
Optional |
string |
Sort the results using a Qualys token. For example, ID or Category:
This will provide the " |
| searchAfter | Optional | string |
To get this value, run this same API with the payload below to retrieve the "sortValues" field from the response body:
This is generally used in case if you want to fetch more than 10,000 records. |
API Request
"curl --location --request POST""https://<qualys_base_url>/sm/v2/assetjobs/search""\\
--header""Content-Type: application/json""\\
--header""Authorization: Bearer <authToken>""\\
--data-raw""
{
"filter": "script.name:Auto_script_22062022_074300047",
"sort": "[{\"created.dateTime\": \"desc\"}, {\"id\": \"desc\"}]",
"pageSize": 5,
"includeScriptResult": true
}
Request Body
{
"filter": "script.name:Auto_script_22062022_074300047",
"sort": "[{\"created.dateTime\": \"desc\"}, {\"id\": \"desc\"}]",
"pageSize": 5,
"includeScriptResult": true
}
Response
{
"body": {
"totalCount": 132,
"list": [
{
"sortValues": [1774951243822,"805485"],
"data": {
"lastCheckedIn": 1774953051060,
"test": false,
"scriptResult": null,
"created": {"dateTime": 1774951243822},
"customerUuid": "93a2c1c4-5568-63be-81ff-8f8fa95aa479",
"isTest": false,
"isAssetDisconnected": false,
"agentVersion": "7.4.0.32",
"id": "805485",
"job": {
"scriptId": 276233,
"scriptLanguage": "Shell",
"scriptType": "Custom Script",
"scriptSeverity": 3,
"scriptName": "Auto_script_22062022_074300047",
"correlationUuid": "985893f0-6e95-4950-b5b3-96fc28ea1d5c",
"id": 686754,
"platform": "LINUX",
"scriptCategory": "System Maintenance"
},
"asset": {
"address": "10.115.126.220",
"name": "rhel9r0-vm",
"id": 85548170,
"agentUuid": "ded35eb8-8c58-4a93-9c99-eab8a9015836",
"operatingSystem": "Red Hat Enterprise Linux 9.5",
"tags": null
},
"manifestId": "3c13da9b-9d7e-43b6-9acf-b76fa41290d5",
"status": "MANIFEST_PUBLISHED"
}
}
]
}
}
For more details, refer to the Pagination Support for APIs.