# Method: projects.patchJobs.execute

- [HTTP request](https://docs.cloud.google.com/compute/docs/osconfig/rest/v1beta/projects.patchJobs/execute#body.HTTP_TEMPLATE)
- [Path parameters](https://docs.cloud.google.com/compute/docs/osconfig/rest/v1beta/projects.patchJobs/execute#body.PATH_PARAMETERS)
- [Request body](https://docs.cloud.google.com/compute/docs/osconfig/rest/v1beta/projects.patchJobs/execute#body.request_body)
  - [JSON representation](https://docs.cloud.google.com/compute/docs/osconfig/rest/v1beta/projects.patchJobs/execute#body.request_body.SCHEMA_REPRESENTATION)
- [Response body](https://docs.cloud.google.com/compute/docs/osconfig/rest/v1beta/projects.patchJobs/execute#body.response_body)
- [Authorization scopes](https://docs.cloud.google.com/compute/docs/osconfig/rest/v1beta/projects.patchJobs/execute#body.aspect)
- [IAM Permissions](https://docs.cloud.google.com/compute/docs/osconfig/rest/v1beta/projects.patchJobs/execute#body.aspect_1)
- [Try it!](https://docs.cloud.google.com/compute/docs/osconfig/rest/v1beta/projects.patchJobs/execute#try-it)

Patch VM instances by creating and running a patch job.

### HTTP request

`POST https://osconfig.googleapis.com/v1beta/{parent=projects/*}/patchJobs:execute`

The URL uses [gRPC Transcoding](https://google.aip.dev/127) syntax.

### Path parameters

| Parameters ||
|---|---|
| `parent` | `string` Required. The project in which to run this patch in the form `projects/*` |

### Request body

The request body contains data with the following structure:

| JSON representation |
|---|
| ``` { "description": string, "instanceFilter": { object (`https://docs.cloud.google.com/compute/docs/osconfig/rest/v1beta/PatchInstanceFilter`) }, "patchConfig": { object (`https://docs.cloud.google.com/compute/docs/osconfig/rest/v1beta/PatchConfig`) }, "duration": string, "dryRun": boolean, "displayName": string, "rollout": { object (`https://docs.cloud.google.com/compute/docs/osconfig/rest/v1beta/PatchRollout`) } } ``` |

| Fields ||
|---|---|
| `description` | `string` Description of the patch job. Length of the description is limited to 1024 characters. |
| `instanceFilter` | ``object (`https://docs.cloud.google.com/compute/docs/osconfig/rest/v1beta/PatchInstanceFilter`)`` Required. Instances to patch, either explicitly or filtered by some criteria such as zone or labels. |
| `patchConfig` | ``object (`https://docs.cloud.google.com/compute/docs/osconfig/rest/v1beta/PatchConfig`)`` Patch configuration being applied. If omitted, instances are patched using the default configurations. |
| `duration` | ``string (`https://protobuf.dev/reference/protobuf/google.protobuf#duration` format)`` Duration of the patch job. After the duration ends, the patch job times out. A duration in seconds with up to nine fractional digits, ending with '`s`'. Example: `"3.5s"`. |
| `dryRun` | `boolean` If this patch is a dry-run only, instances are contacted but will do nothing. |
| `displayName` | `string` Display name for this patch job. This does not have to be unique. |
| `rollout` | ``object (`https://docs.cloud.google.com/compute/docs/osconfig/rest/v1beta/PatchRollout`)`` Rollout strategy of the patch job. |

### Response body

If successful, the response body contains an instance of `https://docs.cloud.google.com/compute/docs/osconfig/rest/v1beta/projects.patchJobs#PatchJob`.

### Authorization scopes

Requires the following OAuth scope:

- `https://www.googleapis.com/auth/cloud-platform`

For more information, see the [Authentication Overview](https://docs.cloud.google.com/docs/authentication#authorization-gcp).

### IAM Permissions

Requires the following [IAM](https://cloud.google.com/iam/docs) permission on the `parent` resource:

- `osconfig.patchJobs.exec`

For more information, see the [IAM documentation](https://cloud.google.com/iam/docs).