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

POST/sm/v1/assetjobs/search

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.

SampleSample

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.