Security Controls REST API

Home 

Exercise 6 - Deploy All Missing Patches

Goal

Deploy all patches that were identified as missing in the patch scan performed in Exercise 3.

Requirements

You will need to know the ID of the patch scan and the ID of the patch deployment template you want to use when performing the deployment.

To determine the patch scan ID, look in the output from Exercise 3

In the sample output in Exercise 3, the patch scan ID is 8bce9fdd-0cf8-40b0-8ecc-b0914a9c831a.

To determine the IDs of the available patch deployment templates, perform the following GET request:

https://localhost:3121/st/console/api/v1.0/patch/deploytemplates

Try it yourself

Perform a deployment of all missing patches identified during a patch scan by submitting a POST request similar to the following:

Change the scanId and templateId values as needed.

Postman Example

            https://localhost:3121/st/console/api/v1.0/patch/deployments
            {
            "scanId":"8bce9fdd-0cf8-40b0-8ecc-b0914a9c831a", 
            "templateId":"7b5bc7e4-7437-47ac-ae2e-569ffdb0ccf8"
            }
			

PowerShell script example

             
            $scanId = "8bce9fdd-0cf8-40b0-8ecc-b0914a9c831a"
            $patchDeployTemplateId = "4c7069eb-6e1c-4352-91fc-04d4d8abc07b"
            $patchDeployUrl = "https://localhost:3121/st/console/api/v1.0/patch/deployments"
            $patchDeployBody =
            @{
            	ScanId = $scanId;
            	TemplateId = $patchDeployTemplateId;
            } | ConvertTo-Json -Depth 99
            $deploy = Invoke-WebRequest -Method Post -Credential $credential -Uri $patchDeployUrl -Body $patchDeployBody -ContentType "application/json" | ConvertTo-Json -Depth 99
			

Output

The result is a JSON-formatted response similar to the following:

StatusCode:

202

Content:

null

Headers:

             {
            	[Operation-Location, https://device-name.fakedomain.com:3121/st/console/api/v1.0/operations/ac0edcc9-0780-479c-a95e-f76f9fea80a4?runAsCredentialId=9b59a098-4e9b-4ff2-b595-fdb7df6e0c47],
            	 [Content-Length, 4],
            	 [Content-Type, application/json; charset=utf-8],
            	 [Date, Mon, 29 Apr 2019 19:43:55 GMT]
            }
			

Was this article useful?    

The topic was:

Inaccurate

Incomplete

Not what I expected

Other