Fetch Asset Job Details using Job Name or Job ID API

Use this API to fetch asset jobs by specifying the job name or the job ID.

POST sm/v2/assetjobs/search

Input ParametersInput Parameters

Parameter

Mandatory/Optional

Data Type

Description

filter

Optional

string

Filter 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, "job.id:22580"

startAt/endAt

Optional

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).

includeScriptResult

Optional

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

Optional

string

The page to be returned. Starts from zero.

pageSize

Optional

string

The number of records per page to be included in the response. Default is 10.

sort

Optional

string

 Sort results in ascending or descending order.

searchAfter

Optional

string

This parameter is required to fetch more than 10,000 rows.

Sample: Get Asset Jobs Filtered by Job ID and searchAfter ParameterSample: Get Asset Jobs Filtered by Job ID and searchAfter Parameter

API Request

 "curl --location --request POST""https://<qualys_base_url>/sm/v2/assetjobs/search""\\
--header""Authorization: <Bearer Token> \\
--header ""Content-Type":"application/json"" \\
--data-raw "{
   "filter":"job.id:25389",
   "sort":"[{\"created.dateTime\":\"desc\"}]",
   "searchAfter":[
      "1673366408146"
   ]
}"'"          

Request Body

 {
"filter": "job.id:25389",
"sort": "[{\"created.dateTime\":\"desc\"}]",
"searchAfter":["1673366408146"]
}

Response

{
   "    ""errorCode":null,
   "    ""message":null,
   "    ""body":{
      "        ""totalCount":3,
      "        ""list":[
         "            "{
            "                ""sortValues":[
                                   1673366408141
                
            ],
            "                ""data":{
               "                    ""test":false,
               "                    ""durationInMillis":3141,
               "                    ""created":{
                  "                        ""dateTime":1673366408141
                    
               },
               "                   ""schedulerId":"<SCHEDULER ID>",
               "                    ""executionEndTime":1673366418141,
               "                    ""output":{
                  "                        ""code":0,
                  "                        ""text":"EXECUTION PASSED""                    "
               },
               "                   ""customerUuid":"<CUSTOMER UUID>",
               "                    ""enddate":"2023-01-10T16:01:04.547+00:00",
               "                    ""isTest":false,
               "                    ""executionStartTime":1673366415000,
               "                    ""id":"87671",
               "                    ""job":{
                  "                       ""scriptId":"<SCRIPT ID>",
                  "                        ""scriptType":"PowerShell",
                  "                        ""scriptSeverity":1,
                  "                        ""scriptName":"Auto_script_22062022_074300047",
                  "                       ""correlationUuid":"<CORRELATION RULE UUID>",
                  "                        ""id":25389,
                  "                        ""platform":"WINDOWS",
                  "                        ""scriptCategory":"Data Backup""                    "
               },
               "                    ""asset":{
                  "                        ""address":"XX.XXX.XXX.XXX",
                  "                       ""name":"<ASSET NAME>",
                  "                       ""id":"<ASSET ID>",
                  "                       ""agentUuid":"<AGENT UUID>",
                  "                        ""operatingSystem":"Microsoft Windows 10 Pro",
                  "                        ""tags":[
                     "                            "{
                        "                                ""name":"Cloud Agent",
                        "                               ""tagUuid":"<TAG UUID>",
                        "                                ""id":16245104
                            
                     }"                        "
                  ]"                    "
               },
               "                   ""manifestId":"<MANIFEST ID>",
               "                   ""schedulerName":"<SCHEDULER NAME>",
               "                    ""status":"EXECUTION PASSED""                "
            }"            "
         }"           "
      }"        "
   ]"    "
}