Fetch Jobs by Script Name or Script ID API

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

 POST sm/v2/jobs/search

Input ParametersInput Parameters

Parameter

Mandatory/Optional

Data Type

Description

filter

Optional

string

Filter the 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 – “scriptId: <SCRIPT_ID>”

startAt/endAt

Optional

string

Filter script jobs based on the time when the jobs are generated (dateTime) or the time when the jobs are processed at the Qualys platform (processedTime).

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

ort results in ascending or descending order. For example, "sort":"[{\"name\":\"asc\"}]"

searchAfter

Optional

string

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

Sample: Get Scripts by Specifying Value for searchAfter ParameterSample: Get Scripts by Specifying Value for searchAfter Parameter

API Request

"curl --location --request POST""https://<qualys_base_url/sm/v2/jobs/search""\\
--header""Authorization: <Bearer Token> \\
--header ""Content-Type":"application/json"" \\
--data-raw "{
   "   ""filter":"script.name:Auto_script_22062022_074300047",
   "sort":"[{\"created.dateTime\":\"desc\"},{\"id\":\"desc\"}]",
   "pageSize":10,
   "    ""searchAfter":[
      1673236800800,
      "25310"
   ]"   "
}"'"
       
    

Request Body

 {
   "filter":"script.name:Auto_script_22062022_074300047",
"sort":"[{\"created.dateTime\":\"desc\"},{\"id\":\"desc\"}]", "pageSize":10,
    "searchAfter":[1673236800800,"25310"]    
}

Response


       {
   "   ""errorCode":null,
   "   ""message":null,
   "   ""body":{
      "       ""totalCount":70,
      "       ""list":[
         "           "{
            "               ""sortValues":[
                                  1673222405175,
               "                   ""25309""               "
            ],
            "               ""data":{
               "                   ""severity":1,
               "                   ""test":false,
               "                   ""created":{
                  "                       ""dateTime":1673222405175
                   
               },
               "                   ""executionType":"Automated",
               "                   ""schedulerId":"<SCHEDULER ID>",
               "                   ""correlationUuid":"<CORRELATION RULE ID>",
               "                   ""threshold":250,
               "                   ""title":"<SCRIPT NAME>",
               "                   ""platform":"WINDOWS",
               "                   ""updatedDateTime":1673222405175,
               "                   ""scriptId":19218,
               "                   ""customerUuid":"<CUSTOMER UUID>",
               "                   ""isTest":false,
               "                   ""scriptType":"PowerShell",
               "                   ""id":"25309",
               "                   ""category":{
                  "                       ""name":"Data Backup",
                  "                       ""id":1
                   
               },
               "                   ""schedulerName":"<SCHEDULER NAME>""               "
            }"            
           "
         }"       "
      ]"   "
   }
}