# Method: projects.configs.variables.watch

- [HTTP request](https://docs.cloud.google.com/deployment-manager/runtime-configurator/reference/rest/v1beta1/projects.configs.variables/watch#body.HTTP_TEMPLATE)
- [Path parameters](https://docs.cloud.google.com/deployment-manager/runtime-configurator/reference/rest/v1beta1/projects.configs.variables/watch#body.PATH_PARAMETERS)
- [Request body](https://docs.cloud.google.com/deployment-manager/runtime-configurator/reference/rest/v1beta1/projects.configs.variables/watch#body.request_body)
  - [JSON representation](https://docs.cloud.google.com/deployment-manager/runtime-configurator/reference/rest/v1beta1/projects.configs.variables/watch#body.request_body.SCHEMA_REPRESENTATION)
- [Response body](https://docs.cloud.google.com/deployment-manager/runtime-configurator/reference/rest/v1beta1/projects.configs.variables/watch#body.response_body)
- [Authorization Scopes](https://docs.cloud.google.com/deployment-manager/runtime-configurator/reference/rest/v1beta1/projects.configs.variables/watch#body.aspect)
- [Try it!](https://docs.cloud.google.com/deployment-manager/runtime-configurator/reference/rest/v1beta1/projects.configs.variables/watch#try-it)

Watches a specific variable and waits for a change in the variable's value. When there is a change, this method returns the new value or times out.

If a variable is deleted while being watched, the `variableState` state is set to `DELETED` and the method returns the last known variable `value`.

If you set the deadline for watching to a larger value than internal timeout (60 seconds), the current variable value is returned and the `variableState` will be `VARIABLE_STATE_UNSPECIFIED`.

To learn more about creating a watcher, read the [Watching a Variable for Changes](https://docs.cloud.google.com/deployment-manager/runtime-configurator/watching-a-variable) documentation.

### HTTP request

`POST https://runtimeconfig.googleapis.com/v1beta1/{name=projects/*/configs/*/variables/**}:watch`

The URL uses [gRPC Transcoding](https://github.com/googleapis/googleapis/blob/master/google/api/http.proto) syntax.

### Path parameters

| Parameters ||
|---|---|
| `name` | `string` The name of the variable to watch, in the format: `projects/[PROJECT_ID]/configs/[CONFIG_NAME]` Authorization requires the following [Google IAM](https://cloud.google.com/iam) permission on the specified resource `name`: - `runtimeconfig.variables.watch` <br /> |

### Request body

The request body contains data with the following structure:

| JSON representation ||
|---|---|
| ``` { "newerThan": string } ``` |

| Fields ||
|---|---|
| `newerThan` | ``string (`https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.Timestamp` format)`` If specified, checks the current timestamp of the variable and if the current timestamp is newer than `newerThan` timestamp, the method returns immediately. If not specified or the variable has an older timestamp, the watcher waits for a the value to change before returning. A timestamp in RFC3339 UTC "Zulu" format, accurate to nanoseconds. Example: `"2014-10-02T15:01:23.045123456Z"`. <br /> |

### Response body

If successful, the response body contains an instance of `https://docs.cloud.google.com/deployment-manager/runtime-configurator/reference/rest/v1beta1/projects.configs.variables#Variable`.

### Authorization Scopes

Requires one of the following OAuth scopes:

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

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

## Try it!