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": 1,
"list": [
{
"lastCheckedIn": 1777352192086,
"test": false,
"scriptOutputSizeInBytes": 32,
"durationInMillis": 375,
"scriptResult": "U3VtIG9mIDIwIGFuZCAyMCBpcyA0MAo=",
"created": {
"dateTime": 1777291233235
},
"schedulerId": "d1a22786-2ddb-4942-8dda-6a03034162f0",
"executionEndTime": 1777292498375,
"output": {
"code": 0,
"text": ""
},
"customerUuid": "74c1bcdd-9bbb-e9dd-802a-65e2c579abc0",
"enddate": "2026-04-27T12:22:28.761+00:00",
"isTest": false,
"isAssetDisconnected": false,
"agentVersion": "6.4.1.2",
"executionStartTime": 1777292498000,
"id": "829948",
"job": {
"scriptId": 358790,
"scriptLanguage": "PowerShell-Script",
"scriptType": "Custom QID",
"scriptSeverity": 3,
"scriptName": "Auto_script_22062022_074300047",
"correlationUuid": "71a6f25b-f0cf-4807-8456-de3d6d913367",
"id": 711314,
"platform": "WINDOWS",
"scriptCategory": "Activity Monitoring"
},
"asset": {
"address": "10.115.126.237",
"name": "win10-fim1",
"id": 86635460,
"agentUuid": "b90bfeda-cf6b-486f-a64e-cb79f416b380",
"operatingSystem": "Microsoft Windows 10 Pro 10.0.19045 64-bit N/A Build 19045 UBR 5608",
"tags": [
{
"name": "ats-1866-eval-return-code",
"tagUuid": "458932ca-26a5-4527-a257-70457945c476",
"id": 57024876
},
{
"name": "Cloud Agent",
"tagUuid": "5d551f4b-038e-4076-a111-52ce3a1443e9",
"id": 16245104
},
{
"name": "testTagSet",
"tagUuid": "bb7cca7f-4901-4db9-9052-e64b68116155",
"id": 35574065
}
]
},
"manifestId": "2daf2101-e86f-4a88-8d6e-72d59094cc65",
"schedulerName": "SHG_ScheduleCheck",
"status": "EXECUTION PASSED"
}
]
}
}
For more details, refer to the Pagination Support for APIs.