Create a Deployment Job

Use this API to create a deployment job by providing inputs in the request body. When you create a Windows or Linux deployment job, and the request is successful, you get a 201 response code.

POST/pm/v1/deploymentjob

Request Body ParametersRequest Body Parameters

Parameter

 Mandatory/Optional

Data Type 

Description

approvedPatches

Optional

string

Specify a list of patches that you want to add to the job

filterType 

Optional

string

Specify the relationship between selected tags.

Available values: Any, All

Default value: Any

exclusionFilterType

 Optional

string

Specify the relationship between excluded tags.

Available values: Any, All

Default value: Any

scheduleType

 Mandatory

string

Specify the schedule to run the job.

Available values: On-demand, Once, Daily, Weekly, and Monthly.

startDateTime

Optional: On-demand job.

Mandatory: Other job types.

string

Specify the time to start the job.

Format example: 2022-2-20 01:18:30 PM

recurring

 Optional

 

Specify if the job is recurring.

Available values: True, False

dayOfMonth

 Optional

string

Specify a day between 1 to 31 to run the job.

recurringLastDayOfMonth

 Optional

 

Specify if you want to job to run on the last day of the month.

Available values: True, False

monthlyRecurringType

 Optional

string

Specify if you want to run the job on the Patch Tuesday schedule

Available values: 0 (not - Patch Tuesday), and 1 (Patch Tuesday).

Default value: 0

patchTuesdayPlusXDays

 Optional

string

Specify the value to set the schedule to run the job up to 27 days before or after Patch Tuesday.

When you specify a value between -1 and -27, the job runs before Patch Tuesday according to that value. 

When you specify a value between 1 and 27, the job runs after Patch Tuesday according to that value. 

Platform support: Windows and Linux

recurringDayOfMonth

 Optional

string

Specify a value between 1 to 5 to run the job on a specific day of a week in the month.

For example, the second Monday of the month.

recurringWeekDayOfMonth

 Optional

string

Specify a value between 0-6 to run a job on a specific day of the week.

For example, 0=Sunday, 1=Monday, and so on.

recurringWeekDays

 Optional

string

Replace 0 with 1 in the "0,0,0,0,0,0,0" sequence to run the job on a specific day of the week.

For example, "0,0,1,0,0,0,0" to run the job on Tuesday.

dynamicQQLType

 Optional

string

Specify if the job is QQL type.

Available values: 0 (no QQL), 1 (Patch QQL), 2 (Vulnerability QQL)

Default value: 0

isDynamicPatchesQQL

 Optional

Boolean

Specify if the QQL-job uses Patches tokens.

Available values: True, False

continueOnPatchFailure 

 Optional

Boolean (Linux job only)

Specify if the Linux installation job should run after a patch in the package fails to install.

Available values: True, False

preDeployment

 Optional

 string

Specify a message you want to show before the deployment starts. If you don't want to show a message, keep the value as null.

duringDeployment 

 Optional

 string

Specify a message you want to show before the deployment starts. If you don't want to show a message, keep the value null.

postDeployment

 Optional

 string

Specify a message you want to show after the job is deployed. If you don't want to show a message, keep the value null.

onComplete

 Optional

string

Specify a message you want to show after the job is complete. If you don't want to show a message, keep the value null.

rebootCountdown

 Optional

string

Specify a message you want to show before reboot countdown starts. If you don't want to show a message, keep the value null.

rebootOption

 Optional

string

Specify a message you want to show when the reboot is complete. If you don't want to show a message, keep the value null.

suppressReboots

 Optional

string

Specify if you want to allow users to suppress a reboot after the job.

Available values: True, False

Default value: False

platform

 Optional

string

Specify the platform type.

- Available values: Linux, Windows

- Default value: Windows

minimizeWindow

 Optional

Boolean (Windows job only)

Specify if you want to allow users to minimize the job window.

Available values: True, False

Default value: False

type

 Mandatory

string

Specify the job type.

Available values: Install (Windows and Linux), Rollback (Windows only)

Default value: Install

status

 Optional

string

Specify the job status.

Available values: Disabled, Enabled

Default value: Disabled

timeout/timeoutUnit

 Optional

string

Specify if the job should time out in hours (1 to 168) or minutes (1 to 10080)

timezoneType

 Optional

string

Specify if you want to run the job in the agent time zone of a specific time zone.

Available values: AGENT_TZ, SPECIFIC_TZ

timezone

 Optional

string

Specify the time zone in which you want to run the job. To refer to the available time zones, see List of Time Zones.

opportunisticDownloads

 Optional

Boolean (Windows job only)

Specify if you want the agent to attempt to download the patches before the job starts.

Available values: True, False

Default value: False

action 

 Optional

string (Windows job only)

Specify if you want to execute an action before or after a job runs. 

Available values (pre-actions): Run Script, Install Software, Change Registry Key, Uninstall Software, and System Reboot.

Available values (post-actions): Run Script, Install Software, Change Registry Key, and Uninstall Software.

script/detectionScript

 Optional

string (Windows job only)

Specify the Base 64 encoded script that you want to run as an action

scriptType

 Optional

string (Windows job only)

Specify the Powershell script that you want to run as a part of the job.

detectionScriptType

 Optional

string (Windows job only)

Specify the Powershell script that you want to run as a part of the job

linkedJobId

Optional

string

Specify a job ID you want to link. If you do not want to link a job, keep the value "null".

notification

 -

Optional

-

Notify the user at the start and end of the job.

notificationTypes

Boolean

Enter "true" for email.

notificationConfigs

  • recipientEmails

  • completedPercentage

 

  • string

  • integer

Enter the email IDs of recipients and the completion percentage between 1 to 100.

If you do not want to notify,  keep the value null.

notificationEvents

Boolean

Enter "true" for at least one of the following parameters: "onJobStart" or "onJobComplete".

Available values: true, false

downloadRandomizeTime


   

 

Optional

 

 String

Provide the job randomize time in hours or minutes.

Note:

- The maximum randomize time you can provide is 2 hours or 120 minutes.

- This value must be less than the timeout/timeoutUnit.(Patch Window)

 

downloadRandomizeTimeUnit

 

Optional

 

 String

Provide the download Randomize time unit as "HOURS" or "MINUTES".

additionalDynamicQQLType

 

 

Optional

 

String

 

Specify if the job is QQL type.


Available values:  1 (Patch QQL), 2 (Vulnerability QQL)

customPatchURLId

 

Optional

Integer 

Specify the customPatchURLId value. This is nothing but the "id" value received from the Fetch Custom Patch Download URLs API.

Sample - Create a Windows on-demand deployment job with pre-actions and post-actionsSample - Create a Windows on-demand deployment job with pre-actions and post-actions

API request

    
curl -X POST 
"https://<QualysBaseURL>/pm/v1/deploymentjob" -H "accept: application/json" -H "Authorization: Bearer <<jwt token>>"
    

Request Body - Specify the inputs to create a deployment job

      {
  "name": "Public API on demand Window job with specific patches",
  "description": "Created via public API",
  "approvedPatches": [
    "ca0d50b1-df21-31ef-aa9b-eec805b3a517",
    "9285e676-6340-3ba7-b124-31d84542c7bf"
  ],
  "assetIds": [
    "ac66e55a-efc6-4a8d-9f61-00d871572b96"
  ],
  "assetTagIds": [
    "f81f37b3-a32b-4aa0-a428-12cad6e37db1"
  ],
  "filterType": "Any",
  "exclusionAssetIds": [
    "94c0bc01-3b1b-4b4b-84a0-b9fe3c9aebb0"
  ],
  "exclusionFilterType": "Any",
  "exclusionTagIds": [
    "1de6c626-de40-4dee-81f8-ae022cd9726a"
  ],
  "coAuthorUserIds": [
    "568be9b8-cbbb-47bf-8132-e4f3c2c46e6c"
  ],
  "preDeployment": null,
  "duringDeployment": {
    "description": "During deployment Description",
    "userMessage": "During deployment userMessage"
  },
  "postDeployment": {
    "onComplete": {
      "description": "On complete Description",
      "userMessage": "On complete userMessage"
    },
    "rebootCountdown": {
      "interval": 15,
      "intervalUnit": "MINUTES",
      "userMessage": "Reboot Countdown usermessage",
      "description": "Reboot Countdown description"
    },
    "rebootOption": {
      "deferment": {
        "count": 3,
        "interval": 1,
        "intervalUnit": "HOURS"
      },
      "description": "rebootOption description",
      "userMessage": "rebootOption user message"
    },
    "suppressReboots": false
  },
  "platform": "Windows",
  "minimizeWindow": "true",
  "type": "Install",
  "status": "Disabled",
  "timeout": 6,
  "timeoutUnit": "HOURS",
  "recurring": false,
  "scheduleType": "On-demand",
  "opportunisticDownloads": false,
  "downloadRandomizeTime": 2,
  "downloadRandomizeTimeUnit": "HOURS",
  "notification": {
    "notificationTypes": {
      "email": true
    },
    "notificationConfigs": {
      "recipientEmails": "abc@gmail.com",
      "completedPercentage": 80
    },
    "notificationEvents": {
      "onJobStart": true,
      "onJobComplete": false
    }
  },
  "preDeployActions": [
    {
      "action": "Run Script",
      "params": {
        "actionItem": "Notepad detection script"
      },
      "script": "JHc2ND1HZXQtSXRlbVByb3BlcnR5IEhLTE06XFNvZnR3YXJlXFdvdzY0MzJOb2RlXE1pY3Jvc29mdFxXaW5kb3dzXEN1cnJlbnRWZXJzaW9uXFVuaW5zdGFsbFwqIHwgd2hlcmUtT2JqZWN0IERpc3BsYXlOYW1lIC1saWtlICdOb3RlUGFkKysqJwokdzMyPUdldC1JdGVtUHJvcGVydHkgSEtMTTpcU29mdHdhcmVcTWljcm9zb2Z0XFdpbmRvd3NcQ3VycmVudFZlcnNpb25cVW5pbnN0YWxsXCogIHwgd2hlcmUtT2JqZWN0IERpc3BsYXlOYW1lIC1saWtlICdOb3RlUGFkKysqJwppZiAoJHc2NCAtb3IgJHczMikKewogICAgV3JpdGUtb3V0cHV0ICJOb3RlcGFkKysgaXMgYWxyZWFkeSBpbnN0YWxsZWQgb24geW91ciBtYWNoaW5lLiIKfQpFbHNlewogICAgV3JpdGUtT3V0cHV0ICJOb3RlcGFkKysgaXMgbm90IGluc3RhbGxlZCBvbiB5b3VyIG1hY2hpbmUuIgp9IA==",
      "scriptType": "ps"
    },
    {
      "action": "Change Registry Key",
      "params": {
        "actionItem": "DisableUpdate",
        "regKey": "SEtFWV9MT0NBTF9NQUNISU5FXFNPRlRXQVJFXFpvb21cTVNJ",
        "regValueType": "REG_SZ",
        "regValue": "dHJ1ZQ==",
        "regKeyAddNew": false
      },
      "scriptType": "ps"
    },
    {
      "action": "System Reboot",
      "params": {
        "actionItem": "Reboot"
      }
    }
  ],
  "postDeployActions": [
    {
      "action": "Install Software with scriptbased option",
      "params": {
        "actionItem": "Install Notepad",
        "downloadURL": "https://github.com/notepad-plus-plus/notepad-plus-plus/releases/download/v8.6.2/npp.7.5.8.Installer.exe",
        "fileChecksum": "613f36bf5e98be7e56b7ea0c678cfb8534077c2ec1cbe839a854dd0a60278ebb",
        "installMethod": 0
      },
      "script": "JHc2ND1HZXQtSXRlbVByb3BlcnR5IEhLTE06XFNvZnR3YXJlXFdvdzY0MzJOb2RlXE1pY3Jvc29mdFxXaW5kb3dzXEN1cnJlbnRWZXJzaW9uXFVuaW5zdGFsbFwqIHwgd2hlcmUtT2JqZWN0IERpc3BsYXlOYW1lIC1saWtlICdOb3RlUGFkKysqJwokdzMyPUdldC1JdGVtUHJvcGVydHkgSEtMTTpcU29mdHdhcmVcTWljcm9zb2Z0XFdpbmRvd3NcQ3VycmVudFZlcnNpb25cVW5pbnN0YWxsXCogIHwgd2hlcmUtT2JqZWN0IERpc3BsYXlOYW1lIC1saWtlICdOb3RlUGFkKysqJwppZiAoJHc2NCAtb3IgJHczMikKewogICAgV3JpdGUtb3V0cHV0ICJOb3RlcGFkKysgaXMgYWxyZWFkeSBpbnN0YWxsZWQgb24geW91ciBtYWNoaW5lLiIKfQpFbHNlewogICAgV3JpdGUtT3V0cHV0ICJOb3RlcGFkKysgaXMgbm90IGluc3RhbGxlZCBvbiB5b3VyIG1hY2hpbmUuIgp9IA==",
      "scriptType": "ps",
      "detectionScript": "",
      "detectionScriptType": "ps"
    },
    {
      "action": "Uninstall Software",
      "params": {
        "actionItem": "Uninstall Chrome",
        "unInstallRegistryKey": "SEtFWV9MT0NBTF9NQUNISU5FXFNPRlRXQVJFXFdPVzY0MzJOb2RlXE1pY3Jvc29mdFxXaW5kb3dzXEN1cnJlbnRWZXJzaW9uXFVuaW5zdGFsbFxHb29nbGUgQ2hyb21l",
        "unInstallSoftwareDisplayName": "Google Chrome",
        "unInstallSoftwareVersion": "109.0.5414.168",
        "unInstallSoftwareVersionMatch": "Equals"
      },
      "scriptType": "ps"
    },
    {
      "action": "Install Software",
      "params": {
        "actionItem": "Install Notepad with Installer based option",
        "downloadURL": "https://github.com/notepad-plus-plus/notepad-plus-plus/releases/download/v8.6.2/npp.7.5.8.Installer.exe",
        "fileChecksum": "613f36bf5e98be7e56b7ea0c678cfb8534077c2ec1cbe839a854dd0a60278ebb",
        "installMethod": 1
      },
      "detectionScript": "",
      "detectionScriptType": "ps",
      "script": "",
      "scriptType": "ps"
    }
  ]
}

Response


   {
    "customerId": "bc023fd7-4290-f28f-8181-95a46f519f52",
    "id": "cb190c4a-a31a-44f0-b2ce-34f30a09a8d7",
    "schemaVersion": "1.0",
    "name": "Public API on demand Window job with specific patches",
    "type": "Install",
    "status": "Disabled",
    "assetIds": [
        "ac66e55a-efc6-4a8d-9f61-00d871572b96"
    ],
    "assetTagIds": [
        "f81f37b3-a32b-4aa0-a428-12cad6e37db1"
    ],
    "matchAllTagIds": null,
    "exclusionTagIds": [
        "1de6c626-de40-4dee-81f8-ae022cd9726a"
    ],
    "exclusionAssetIds": [
        "94c0bc01-3b1b-4b4b-84a0-b9fe3c9aebb0"
    ],
    "coAuthorUserIds": [
        "568be9b8-cbbb-47bf-8132-e4f3c2c46e6c"
    ],
    "approvedPatches": [
        "ca0d50b1-df21-31ef-aa9b-eec805b3a517",
        "9285e676-6340-3ba7-b124-31d84542c7bf"
    ],
    "disabledPatches": null,
    "patchCount": 2,
    "scheduleType": "On-demand",
    "startDateTime": "2022-10-19 08:47:34 AM",
    "recurring": false,
    "recurringWeekDays": null,
    "dayOfMonth": null,
    "recurringDayOfMonth": null,
    "recurringWeekDayOfMonth": null,
    "timezoneType": "SPECIFIC_TZ",
    "timezone": "UTC",
    "timeout": 6,
    "timeoutUnit": "HOURS",
    "preDeployment": {
        "userMessage": "",
        "description": "",
        "deferment": {
            "count": 3,
            "interval": 1,
            "intervalUnit": "HOURS"
        }
    },
    "duringDeployment": {
        "userMessage": "During deployment userMessage",
        "description": "During deployment Description"
    },
    "postDeployment": {
        "suppressReboots": false,
        "rebootOption": {
            "userMessage": "rebootOption user message",
            "description": "rebootOption description",
            "deferment": {
                "count": 3,
                "interval": 1,
                "intervalUnit": "HOURS"
            }
        },
        "rebootCountdown": {
            "interval": 15,
            "intervalUnit": "MINUTES",
            "userMessage": "Reboot Countdown usermessage",
            "description": "Reboot Countdown description"
        },
        "onComplete": {
            "userMessage": "On complete userMessage",
            "description": "On complete Description"
        }
    },
    "description": "Created via public API 3",
    "createdBy": {
        "user": {
            "id": "c4c71f94-4ef6-7e6f-8260-11704fa58172",
            "name": "qxxxs_rxx7"
        },
        "date": 1666169253730
    },
    "updatedBy": {
        "user": null,
        "date": null
    },
    "deletedBy": {
        "user": null,
        "date": null
    },
    "assetCount": null,
    "opportunisticDownloads": false,
    "filterType": "Any",
    "exclusionFilterType": "Any",
    "taggedAssetCount": 0,
    "minimizeWindow": true,
    "dynamicPatchesQQL": null,
    "isDynamicPatchesQQL": null,
    "dynamicQQLType": null,
    "platform": "Windows",
    "continueOnPatchFailure": false,
    "preDeployActions": [
    {
      "actionId": "e3e2a58d-1bf9-45a2-9238-d435c2dadf45",
      "action": "Run Script",
      "actionType": "predeploy",
      "params": {
        "actionItem": "Notepad detection script",
        "timeout": 180
      },
      "script": "c8f2006c-3f0a-5d94-83c7-2ac1dc78063b/e3e2a58d-1bf9-45a2-9238-d435c2dadf45/Script",
      "scriptType": "ps"
    },
    {
      "actionId": "00db1862-7570-4ef8-9464-f8415436814b",
      "action": "Change Registry Key",
      "actionType": "predeploy",
      "params": {
        "actionItem": "DisableUpdate",
        "regKey": "SEtFWV9MT0NBTF9NQUNISU5FXFNPRlRXQVJFXFpvb21cTVNJ",
        "regValueType": "REG_SZ",
        "regValue": "dHJ1ZQ==",
        "regKeyAddNew": false,
        "timeout": 180
      }
    },
    {
            "action": "System Reboot",
            "actionId": "bc4aa991-1e61-4bfc-85ea-ffa389c85e5b",
            "actionType": "predeploy",
            "params": {
                "actionItem": "Reboot",
                "timeout": 180
            },
            "script": "",
            "scriptType": "ps"
        }
  ],
    "postDeployActions": [
    {
      "actionId": "e51da4cb-2508-4227-8f23-7c2f2278bf77",
      "action": "Install Software",
      "actionType": "postdeploy",
      "params": {
        "actionItem": "Install Notepad  with scriptbased option",
        "downloadURL": "https://github.com/notepad-plus-plus/notepad-plus-plus/releases/download/v8.6.2/npp.7.5.8.Installer.exe",
        "downloadProtocol": 0,
        "installMethod": 0,
        "fileChecksum": "613f36bf5e98be7e56b7ea0c678cfb8534077c2ec1cbe839a854dd0a60278ebb",
        "timeout": 180
      },
      "detectionScript": "",
      "detectionScriptType": "ps",
      "script": "c8f2006c-3f0a-5d94-83c7-2ac1dc78063b/e51da4cb-2508-4227-8f23-7c2f2278bf77/Script",
      "scriptType": "ps"
    },
    {
      "actionId": "2437ea86-ae10-4be4-b421-50472a2a7fe1",
      "action": "Uninstall Software",
      "actionType": "postdeploy",
      "params": {
        "actionItem": "Uninstall Chrome",
        "unInstallSoftwareDisplayName": "Google Chrome",
        "unInstallSoftwareVersion": "109.0.5414.168",
        "unInstallSoftwareVersionMatch": "Equals",
        "unInstallRegistryKey": "SEtFWV9MT0NBTF9NQUNISU5FXFNPRlRXQVJFXFdPVzY0MzJOb2RlXE1pY3Jvc29mdFxXaW5kb3dzXEN1cnJlbnRWZXJzaW9uXFVuaW5zdGFsbFxHb29nbGUgQ2hyb21l",
        "timeout": 180
      }
    },
    {
            "action": "Install Software",
            "actionId": "900eee9a-ef6a-4d54-ac82-932d8b981935",
            "actionType": "postdeploy",
            "detectionScript": "",
            "detectionScriptType": "ps",
            "params": {
                "actionItem": "Install Notepad with Installer based option",
                "downloadProtocol": 1,
                "downloadURL": "http://github.com/notepad-plus-plus/notepad-plus-plus/releases/download/v8.6.2/npp.7.5.8.Installer.exe",
                "fileChecksum": "613f36bf5e98be7e56b7ea0c678cfb8534077c2ec1cbe839a854dd0a60278ebb",
                "installMethod": 1,
                "timeout": 180
            },
            "script": "",
            "scriptType": "ps"
        }
  ],
    "applicableAssetCount": 1,
    "monthlyRecurringType": null,
    "patchTuesdayPlusXDays": null,
    "recurringLastDayOfMonth": null,
    "jobCategory": 3,
    "jobTriggerStatus": null,
    "completionPercent": null,
    "totalAssetCount": null,
    "assetResultReceivedCount": null,
    "jobSource": 3,
    "readOnly": false,
    "notification": {
        "notificationTypes": {
            "email": true
        },
        "notificationConfigs": {
            "recipientEmails": "abc@gmail.com",
            "completedPercentage": "80"
        },
        "notificationEvents": {
            "onJobStart": true,
            "onJobComplete": false
        }
    },
    "linkedJobId": null,
    "linkedToJob": null,
    "linkedJobs": null,
    "downloadRandomizeTime": 2,
    "downloadRandomizeTimeUnit": "HOURS",
    "additionalDynamicPatchesQQL": null,
    "additionalDynamicQQLType": null
}

Sample - Create Windows QQL-based installation job for Patch Tuesday without actionsSample - Create Windows QQL-based installation job for Patch Tuesday without actions

API request


        curl -X POST 
        "https://<QualysBaseURL>/pm/v1/deploymentjob" -H "accept: application/json" -H "Authorization: Bearer <<jwt token>>"
    

Request Body - Specify the inputs to create a QQL-based Windows deployment job for Patch Tuesday without actions


    -d '{
    "name": "Windows Public API job 3",
    "description": "Windows job created via public API",
    "approvedPatches": [],
    "assetIds": [
        "bdf79678-e0f3-4c96-9d5c-59b14661ec3f"
    ],
    "assetTagIds": [
        "976d805d-855f-4aa7-8713-b44463f7d081"
    ],
    "matchAllTagIds": [],
    "filterType": "Any",
    "exclusionAssetIds": [
        "e52de00f-8631-4dd5-9ff7-622f3e8d698d"
    ],
    "exclusionFilterType": "Any",
    "exclusionTagIds": [
        "22dcb264-9c2a-4d78-bc55-376396b68a08"
    ],
    "coAuthorUserIds": [
        "568be9b8-cbbb-47bf-8132-e4f3c2c46e6c"
    ],
    "scheduleType": "Monthly",
    "startDateTime": "2022-2-20 01:18:30 PM",
    "recurring": true,
    "dayOfMonth": null,
    "recurringLastDayOfMonth": false,
    "monthlyRecurringType": 1,
    "patchTuesdayPlusXDays": 6,
    "recurringDayOfMonth": null,
    "recurringWeekDayOfMonth": null,
    "recurringWeekDays": "",
    "dynamicPatchesQQL": "isSecurity: true",
    "dynamicQQLType": "1",
    "isDynamicPatchesQQL": true,
    "continueOnPatchFailure": false,
    "downloadRandomizeTime": 15,
    "downloadRandomizeTimeUnit": "MINUTES",
    "preDeployment": {
        "deferment": {
            "count": 3,
            "interval": 1,
            "intervalUnit": "HOURS"
        },
        "description": "preDeployment description",
        "userMessage": "preDeployment user message"
    },
    "duringDeployment": {
        "description": "During deployment Description",
        "userMessage": "During deployment userMessage"
    },
    "postDeployment": {
        "onComplete": {
            "description": "On complete Description",
            "userMessage": "On complete userMessage"
        },
        "rebootCountdown": {
            "interval": 15,
            "intervalUnit": "MINUTES",
            "userMessage": "Reboot Countdown usermessage",
            "description": "Reboot Countdown description"
        },
        "rebootOption": {
            "deferment": {
                "count": 3,
                "interval": 1,
                "intervalUnit": "HOURS"
            },
            "description": "rebootOption description",
            "userMessage": "rebootOption user message"
        },
        "suppressReboots": false
    },
    "platform": "Windows",
    "minimizeWindow": "true",
    "type": "Install",
    "status": "Disabled",
    "timeout": 6,
    "timeoutUnit": "HOURS",
    "timezone": null,
    "timezoneType": "AGENT_TZ",
    "opportunisticDownloads": true,
    "additionalDynamicPatchesQQL":
    "vulnerabilities.vulnerability.criticality:CRITICAL",
    "additionalDynamicQQLType": 2,
    "customPatchURLId": 1004    
}'
    

Response


      {
    "customerId": "6f66747e-2800-7fc7-82d4-1ee7cd30c9fc",
    "id": "7dc64a73-f347-4ed4-b50c-9c645b334907",
    "schemaVersion": "1.0",
    "name": "Winodws Public API job 3",
    "type": "Install",
    "status": "Disabled",
    "assetIds": [
        "bdf79678-e0f3-4c96-9d5c-59b14661ec3f"
    ],
    "assetTagIds": [
        "976d805d-855f-4aa7-8713-b44463f7d081"
    ],
    "matchAllTagIds": [],
    "exclusionTagIds": [
        "22dcb264-9c2a-4d78-bc55-376396b68a08"
    ],
    "exclusionAssetIds": [
        "e52de00f-8631-4dd5-9ff7-622f3e8d698d"
    ],
    "coAuthorUserIds": [
        "568be9b8-cbbb-47bf-8132-e4f3c2c46e6c"
    ],
    "approvedPatches": [],
    "disabledPatches": null,
    "patchCount": 0,
    "scheduleType": "Monthly",
    "startDateTime": "2022-2-20 01:18:30 PM",
    "recurring": true,
    "recurringWeekDays": "",
    "dayOfMonth": null,
    "recurringDayOfMonth": null,
    "recurringWeekDayOfMonth": null,
    "timezoneType": "AGENT_TZ",
    "timezone": null,
    "timeout": 6,
    "timeoutUnit": "HOURS",
    "preDeployment": {
        "userMessage": "preDeployment user message",
        "description": "preDeployment description",
        "deferment": {
            "count": 3,
            "interval": 1,
            "intervalUnit": "HOURS"
        }
    },
    "duringDeployment": {
        "userMessage": "During deployment userMessage",
        "description": "During deployment Description"
    },
    "postDeployment": {
        "suppressReboots": false,
        "rebootOption": {
            "userMessage": "rebootOption user message",
            "description": "rebootOption description",
            "deferment": {
                "count": 3,
                "interval": 1,
                "intervalUnit": "HOURS"
            }
        },
        "rebootCountdown": {
            "interval": 15,
            "intervalUnit": "MINUTES",
            "userMessage": "Reboot Countdown usermessage",
            "description": "Reboot Countdown description"
        },
        "onComplete": {
            "userMessage": "On complete userMessage",
            "description": "On complete Description"
        }
    },
    "description": "Winodws job created via public API",
    "createdBy": {
        "user": {
            "id": "ea9067e4-1c28-e208-80b4-312b7a0449cf",
            "name": "gtham_bw"
        },
        "date": 1645970995557
    },
    "updatedBy": {
        "user": null,
        "date": null
    },
    "deletedBy": {
        "user": null,
        "date": null
    },
    "assetCount": null,
    "opportunisticDownloads": true,
    "filterType": "Any",
    "exclusionFilterType": "Any",
    "taggedAssetCount": 0,
    "minimizeWindow": true,
    "dynamicPatchesQQL": "isSecurity: true",
    "isDynamicPatchesQQL": true,
    "dynamicQQLType": 1,
    "platform": "Windows",
    "continueOnPatchFailure": false,
    "preDeployActions": null,
    "postDeployActions": null,
    "applicableAssetCount": 0,
    "monthlyRecurringType": 1,
    "patchTuesdayPlusXDays": 6,
    "recurringLastDayOfMonth": false,
    "jobCategory": 1,
    "jobTriggerStatus": null,
    "completionPercent": null,
    "totalAssetCount": null,
    "assetResultReceivedCount": null,
    "jobSource": 3,
    "readOnly": false,
    "downloadRandomizeTime": 15,
    "downloadRandomizeTimeUnit": "MINUTES",   
    "customPatchURLId": 1004,
    "additionalDynamicPatchesQQL": "vulnerabilities.vulnerability.criticality:CRITICAL",
    "additionalDynamicQQLType": 2
}  

Sample - Create a Windows rollback jobSample - Create a Windows rollback job

API request


        curl -X POST 
        "https://<QualysBaseURL>/pm/v1/deploymentjob" -H "accept: application/json" -H "Authorization: Bearer <<jwt token>>"
    

Request Body - Specify the inputs to create a uninstall job

    
        -d '{
    "name": "Winodws Public API job 5",
    "description": "Winodws job created via public API",
    "approvedPatches": [
        "ca0d50b1-df21-31ef-aa9b-eec805b3a517",
        "9285e676-6340-3ba7-b124-31d84542c7bf"
    ],
    "assetIds": [
        "bdf79678-e0f3-4c96-9d5c-59b14661ec3f"
    ],
    "assetTagIds": [
        "976d805d-855f-4aa7-8713-b44463f7d081"
    ],
    "matchAllTagIds": [],
    "filterType": "Any",
    "exclusionAssetIds": [
        "e52de00f-8631-4dd5-9ff7-622f3e8d698d"
    ],
    "exclusionFilterType": "Any",
    "exclusionTagIds": [
        "22dcb264-9c2a-4d78-bc55-376396b68a08"
    ],
    "coAuthorUserIds": [
        "568be9b8-cbbb-47bf-8132-e4f3c2c46e6c"
    ],
    "dayOfMonth": null,
    "recurringLastDayOfMonth": false,
    "monthlyRecurringType": 0,
    "patchTuesdayPlusXDays": null,
    "recurringDayOfMonth": null,
    "recurringWeekDayOfMonth": null,
    "recurringWeekDays": "",
    "dynamicPatchesQQL": null,
    "dynamicQQLType": "1",
    "isDynamicPatchesQQL": false,
    "continueOnPatchFailure": false,
    "preDeployment": {
        "deferment": {
            "count": 3,
            "interval": 1,
            "intervalUnit": "HOURS"
        },
        "description": "preDeployment description",
        "userMessage": "preDeployment user message"
    },
    "duringDeployment": {
        "description": "During deployment Description",
        "userMessage": "During deployment userMessage"
    },
    "postDeployment": {
        "onComplete": {
            "description": "On complete Description",
            "userMessage": "On complete userMessage"
        },
        "rebootCountdown": {
            "interval": 15,
            "intervalUnit": "MINUTES",
            "userMessage": "Reboot Countdown usermessage",
            "description": "Reboot Countdown description"
        },
        "rebootOption": {
            "deferment": {
                "count": 3,
                "interval": 1,
                "intervalUnit": "HOURS"
            },
            "description": "rebootOption description",
            "userMessage": "rebootOption user message"
        },
        "suppressReboots": false
    },
    "platform": "Windows",
    "minimizeWindow": "true",
    "type": "Rollback",
    "status": "Disabled",
    "timeout": 6,
    "timeoutUnit": "HOURS",
    "recurring": false,
    "scheduleType": "On-demand",
    "timezone": null,
    "timezoneType": null,
    "startDateTime": null,
    "opportunisticDownloads": false
}'
    

Response

    
        {
    "customerId": "6f66747e-2800-7fc7-82d4-1ee7cd30c9fc",
    "id": "ec3fb8b4-2df5-467e-8ab4-0cd84aec3382",
    "schemaVersion": "1.0",
    "name": "Winodws Public API job 5",
    "type": "Rollback",
    "status": "Disabled",
    "assetIds": [
        "bdf79678-e0f3-4c96-9d5c-59b14661ec3f"
    ],
    "assetTagIds": [
        "976d805d-855f-4aa7-8713-b44463f7d081"
    ],
    "matchAllTagIds": [],
    "exclusionTagIds": [
        "22dcb264-9c2a-4d78-bc55-376396b68a08"
    ],
    "exclusionAssetIds": [
        "e52de00f-8631-4dd5-9ff7-622f3e8d698d"
    ],
    "coAuthorUserIds": [
        "568be9b8-cbbb-47bf-8132-e4f3c2c46e6c"
    ],
    "approvedPatches": [],
    "disabledPatches": null,
    "patchCount": 0,
    "scheduleType": "On-demand",
    "startDateTime": "2022-2-27 03:04:46 PM",
    "recurring": false,
    "recurringWeekDays": "",
    "dayOfMonth": null,
    "recurringDayOfMonth": null,
    "recurringWeekDayOfMonth": null,
    "timezoneType": "SPECIFIC_TZ",
    "timezone": "UTC",
    "timeout": 6,
    "timeoutUnit": "HOURS",
    "preDeployment": {
        "userMessage": "preDeployment user message",
        "description": "preDeployment description",
        "deferment": {
            "count": 3,
            "interval": 1,
            "intervalUnit": "HOURS"
        }
    },
    "duringDeployment": {
        "userMessage": "During deployment userMessage",
        "description": "During deployment Description"
    },
    "postDeployment": {
        "suppressReboots": false,
        "rebootOption": {
            "userMessage": "rebootOption user message",
            "description": "rebootOption description",
            "deferment": {
                "count": 3,
                "interval": 1,
                "intervalUnit": "HOURS"
            }
        },
        "rebootCountdown": {
            "interval": 15,
            "intervalUnit": "MINUTES",
            "userMessage": "Reboot Countdown usermessage",
            "description": "Reboot Countdown description"
        },
        "onComplete": {
            "userMessage": "On complete userMessage",
            "description": "On complete Description"
        }
    },
    "description": "Winodws job created via public API",
    "createdBy": {
        "user": {
            "id": "ea9067e4-1c28-e208-80b4-312b7a0449cf",
            "name": "gtham_bw"
        },
        "date": 1645974285950
    },
    "updatedBy": {
        "user": null,
        "date": null
    },
    "deletedBy": {
        "user": null,
        "date": null
    },
    "assetCount": null,
    "opportunisticDownloads": false,
    "filterType": "Any",
    "exclusionFilterType": "Any",
    "taggedAssetCount": 0,
    "minimizeWindow": true,
    "dynamicPatchesQQL": null,
    "isDynamicPatchesQQL": false,
    "dynamicQQLType": 1,
    "platform": "Windows",
    "continueOnPatchFailure": false,
    "preDeployActions": null,
    "postDeployActions": null,
    "applicableAssetCount": 0,
    "monthlyRecurringType": null,
    "patchTuesdayPlusXDays": null,
    "recurringLastDayOfMonth": false,
    "jobCategory": 3,
    "jobTriggerStatus": null,
    "completionPercent": null,
    "totalAssetCount": null,
    "assetResultReceivedCount": null,
    "jobSource": 3,
    "readOnly": false
}
    

Sample - Create a Linux installation jobSample - Create a Linux installation job

API request

    
        curl -X POST 
        "https://<QualysBaseURL</pm/v1/deploymentjob" -H "accept: application/json" -H "Authorization: Bearer <<jwt token>>"
    

Request Body - Specify the inputs to create a Linux deployment job

      {
    "name": "Public API on demand Linux job with patches",
    "description": "Created via public API",
    "approvedPatches": [],
    "assetIds": [
        "0f0266bf-4884-4bf5-9727-c50c9d8fbf78"
    ],
    "assetTagIds": [
        "f81f37b3-a32b-4aa0-a428-12cad6e37db1"
    ],
    "filterType": "Any",
    "exclusionAssetIds": [
        "5f8fd088-0051-0002-1663-005056aa10f0"
    ],
    "exclusionFilterType": "Any",
    "exclusionTagIds": [
        "1de6c626-de40-4dee-81f8-ae022cd9726a"
    ],
    "coAuthorUserIds": [
        "568be9b8-cbbb-47bf-8132-e4f3c2c46e6c"
    ],
    "preDeployment": null,
    "duringDeployment": null,
    "postDeployment": {
        "onComplete": null,
        "rebootCountdown": null,
        "rebootOption": null,
        "suppressReboots": false
    },
    "platform": "Linux",
    "type": "Install",
    "status": "Disabled",
    "timeout": 6,
    "timeoutUnit": "HOURS",
    "recurring": false,
    "scheduleType": "On-demand",
    "opportunisticDownloads": false,
    "notification": {
        "notificationTypes": {
            "email": true
        },
        "notificationConfigs": {
            "recipientEmails": "abc@gmail.com",
            "completedPercentage": "80"
        },
        "notificationEvents": {
            "onJobStart": true,
            "onJobComplete": false
        }
    },
    "linkedJobId": "99ac4e4e-8325-477b-bf98-953fe44820bf",
    "preDeployActions": [
        {
            "action": "Run Script",
            "actionType": "predeploy",
            "params": {
                "actionItem": "S1",
                "timeout": 180
            },
            "script": "bHM=",
            "scriptType": "sh"
        }
    ],
    "postDeployActions": [
        {
            "action": "Run Script",
            "actionType": "postdeploy",
            "params": {
                "actionItem": "S1",
                "timeout": 180
            },
            "script": "bHM=",
            "scriptType": "sh"
        }
    ]
}

Response

    
 {
    "customerId": "bc023fd7-4290-f28f-8181-95a46f519f52",
    "id": "a8b728ad-66a2-4d1e-80a7-ce5c470ac0df",
    "schemaVersion": "1.0",
    "name": "Public API on demand Linux job with patches 1",
    "type": "Install",
    "status": "Disabled",
    "assetIds": [
        "0f0266bf-4884-4bf5-9727-c50c9d8fbf78"
    ],
    "assetTagIds": [
        "f81f37b3-a32b-4aa0-a428-12cad6e37db1"
    ],
    "matchAllTagIds": null,
    "exclusionTagIds": [
        "1de6c626-de40-4dee-81f8-ae022cd9726a"
    ],
    "exclusionAssetIds": [
        "5f8fd088-0051-0002-1663-005056aa10f0"
    ],
    "coAuthorUserIds": [
        "568be9b8-cbbb-47bf-8132-e4f3c2c46e6c"
    ],
    "approvedPatches": [],
    "disabledPatches": null,
    "patchCount": 0,
    "scheduleType": "On-demand",
    "startDateTime": "2022-10-19 09:33:29 AM",
    "recurring": false,
    "recurringWeekDays": null,
    "dayOfMonth": null,
    "recurringDayOfMonth": null,
    "recurringWeekDayOfMonth": null,
    "timezoneType": "SPECIFIC_TZ",
    "timezone": "UTC",
    "timeout": 6,
    "timeoutUnit": "HOURS",
    "preDeployment": {
        "userMessage": "",
        "description": "",
        "deferment": {
            "count": 3,
            "interval": 1,
            "intervalUnit": "HOURS"
        }
    },
    "duringDeployment": {
        "userMessage": "",
        "description": ""
    },
    "postDeployment": {
        "suppressReboots": false,
        "rebootOption": {
            "userMessage": "",
            "description": "",
            "deferment": {
                "count": 3,
                "interval": 1,
                "intervalUnit": "HOURS"
            }
        },
        "rebootCountdown": {
            "interval": 15,
            "intervalUnit": "MINUTES",
            "userMessage": "",
            "description": ""
        },
        "onComplete": {
            "userMessage": "",
            "description": ""
        }
    },
    "description": "Created via public API",
    "createdBy": {
        "user": {
            "id": "c4c71f94-4ef6-7e6f-8260-11704fa58172",
            "name": "qxxxs_rxx7"
        },
        "date": 1666172001492
    },
    "updatedBy": {
        "user": null,
        "date": null
    },
    "deletedBy": {
        "user": null,
        "date": null
    },
    "assetCount": null,
    "opportunisticDownloads": false,
    "filterType": "Any",
    "exclusionFilterType": "Any",
    "taggedAssetCount": 0,
    "minimizeWindow": null,
    "dynamicPatchesQQL": null,
    "isDynamicPatchesQQL": null,
    "dynamicQQLType": null,
    "platform": "Linux",
    "continueOnPatchFailure": false,
    "preDeployActions": [
        {
            "action": "Run Script",
            "actionId": "2cf190a9-086d-47f9-898f-aed4b98dea5a",
            "actionType": "predeploy",
            "params": {
                "actionItem": "S1",
                "timeout": 180
            },
            "script": "bc023fd7-4290-f28f-8181-95a46f519f52/2cf190a9-086d-47f9-898f-aed4b98dea5a/Script",
            "scriptType": "sh"
        }
    ],
    "postDeployActions": [
        {
            "action": "Run Script",
            "actionId": "b52fc1b1-f598-4e6b-90d8-23bfa94b41fe",
            "actionType": "postdeploy",
            "params": {
                "actionItem": "S1",
                "timeout": 180
            },
            "script": "bc023fd7-4290-f28f-8181-95a46f519f52/b52fc1b1-f598-4e6b-90d8-23bfa94b41fe/Script",
            "scriptType": "ps"
        }
    ],
    "applicableAssetCount": 0,
    "monthlyRecurringType": null,
    "patchTuesdayPlusXDays": null,
    "recurringLastDayOfMonth": null,
    "jobCategory": 3,
    "jobTriggerStatus": null,
    "completionPercent": null,
    "totalAssetCount": null,
    "assetResultReceivedCount": null,
    "jobSource": 3,
    "readOnly": false,
    "notification": {
        "notificationTypes": {
            "email": true
        },
        "notificationConfigs": {
            "recipientEmails": "abc@gmail.com",
            "completedPercentage": "80"
        },
        "notificationEvents": {
            "onJobStart": true,
            "onJobComplete": false
        }
    },
    "linkedJobId": "99ac4e4e-8325-477b-bf98-953fe44820bf",
    "linkedToJob": [
        {
            "customerId": "bc023fd7-4290-f28f-8181-95a46f519f52",
            "id": "99ac4e4e-8325-477b-bf98-953fe44820bf",
            "name": "Linux testing job",
            "type": "Install",
            "status": "Disabled",
            "createdBy": {
                "user": {
                    "id": "c4c71f94-4ef6-7e6f-8260-11704fa58172",
                    "name": "qxxxs_rxx7"
                },
                "date": 1665656673543
            },
            "linkedJobReferenceCount": 2,
            "schedule": "On-Demand",
            "previousRun": null,
            "nextRun": null
        }
    ],
    "linkedJobs": null,
    "downloadRandomizeTime": 0,
    "downloadRandomizeTimeUnit": "MINUTES"
}