Import Scripts API

This API lets you import scripts from the Library.

Import Scripts Version 2 API

POSTsm/v2/script-library/import

Input ParametersInput Parameters

Parameter Mandatory/Optional Data Type Description
title Mandatory String Name of the script to be imported
categodyID Mandatory String Category ID of the script to be imported
approved Mandatory Boolean Status of the script to be imported {true/false}
id Mandatory String ID of the script in the library
typeId Mandatory Integer Provide a valid script type ID (Custom Script/Custom QID).
subType Mandatory

(This parameter is mandatory only when the script type is Custom Script)

String Provide a subtype value to label the script.

Accepted values:

  • Detection
  • Response
  • This parameter applies only to Custom Scripts.
  • For Custom QID Scripts, the subType is automatically set to Detection, and for Control ID Remediation scripts, it is set to Response. You do not need to provide this parameter when creating these scripts.
typeName Mandatory String Provide the name of the script type.

You can fetch the script types using the following API:

GET /sm/v1/script-types

The available script types are:

  • Custom Script
  • Custom QID
  • Control ID Remediation

SampleSample

API Request

curl -X POST
'<qualys_base_url>/sm/v2/script-library/import'
--header 'Content-Type: application/json
--header 'Authorization: Bearer {{authToken}}'
--data '{
    "title": "Sample Title",
    "categoryId": 1,
    "id": 234564,
    "approved": true,
    "typeId": 1,
    "typeName": "Custom Script",
    "subType": "Detection"
  }'

Response

{
 "errorCode": "0",
 "message": "Script created from library successfully",
 "body": {
 "id": 86174
 }
} 

Import Scripts Version 1 API

POSTsm/v1/script-library/import

Input ParametersInput Parameters

Parameter Mandatory/Optional Data Type Description
title Mandatory String Name of the script to be imported
categodyID Mandatory String Category ID of the script to be imported
approved Mandatory Boolean Status of the script to be imported {true/false}
id Mandatory String ID of the script in the library
typeId Mandatory Integer Provide a valid script type ID (Custom Script/Custom QID).

SampleSample

API Request

 curl -X POST 'https://<qualys_base_url>/sm/v1/script-library/import'
--header 'Content-Type: application/json'
--header 'Authorization: Bearer {{authToken}}'
--data 
'{
 "title": "Sample Title",
 "categoryId": 1,
 "id": 234564,
 "approved": true/false,
 "typeId": 1
}'

Response

{
 "errorCode": "0",
 "message": "Script created from library successfully",
 "body": {
 "id": 86174
 }
} 

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