List Scripts Based on Script Attributes API

Search list of scripts for a user account.

POST/sm/v1/scripts/search

Input ParametersInput Parameters

Parameter

Mandatory/Optional

Data Type

Description

Filter

Optional

string

Filter the scripts 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":"status:DEPRECATED"

 

Filter the scripts based on their status. For example: Approved, Pending Review, Pending Test, Rejected, Deprecated.

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

 

Sort the results using a Qualys token. For example:

[{\"Created.dateTime\":\"asc\"}]

Authorization

 

Mandatory

string

Authorization token to authenticate to the Qualys Enterprise TruRisk™ Platform.

Prepend the token with ’Bearer’, followed by a space. For example:

Bearer <authToken>

SampleSample

API Request:

"curl --location--request POST""https:// qualys_base_url /sm/v1/scripts/search""\\
--header""Content-Type: application/json""\\
--header""Authorization: Bearer <authToken>""\\
--data-raw""{
\"filter\":\"status: DEPRECATED\"
}"

Request Body: 

 "i) Filter scripts with status ’Rejected’":{
   "    ""filter":"status:REJECTED"
}

Response:

" "{
   "    ""body":{
      "    ""totalCount":1,
      "    ""list":[
         " "{
            "    ""severity":1,
            "    ""testAssets":null,
            "    ""importedFromId":0,
            "    ""approverId":null,
            "    ""created":{
               "    ""dateTime":1651490591578,
               "    ""user":{
                  "   ""name":"<USER NAME>",
                  "   ""id":"<USER ID>""        "
               }"    "
            },
            "    ""blacklistedCommands":"",
            "   ""description":"This script is created for Sanity Automa­tion",
            "    ""lastExecutedDateTime":0,
            "    ""threshold":250,
            "   ""title":"<SCRIPT TITLE>",
            "    ""type":{
               "    ""name":"Powershell",
               "    ""id":4
    
            },
            "    ""excludedAssets":null,
            "    ""assetTags":null,
            "    ""platform":"WINDOWS",
            "    ""approverName":null,
            "    ""subscribedModules":[
               "    ""PC""    "
            ],
            "    ""schedule":{
               "    ""recurringDay":0,
               "    ""recurringTime":null,
               "    ""frequency":"null
    "
            },
            "   ""customerUuid":"<CUSTOMER UUID>",
            "    ""assets":null,
            "    ""hasBlacklistedCommands":false,
            "    ""id":"72524",
            "    ""category":{
               "    ""name":"Data Backup",
               "     ""id":1
    
            },
            "    ""updated":{
               "    ""dateTime":1651490890451,
               "    ""user":{
                  "   ""name":"<USER NAME>",
                  "   ""id":"<USER ID>""    "
               }"    "
            },
            "    ""status":"REJECTED""    "
         }"    "
      ]"    "
   }

To know the details of the response codes, refer to Appendix.