# Method: projects.preview.write

- [HTTP request](https://developers.google.com/assistant/actions/api/reference/rest/v2/projects.preview/write#body.HTTP_TEMPLATE)
- [Path parameters](https://developers.google.com/assistant/actions/api/reference/rest/v2/projects.preview/write#body.PATH_PARAMETERS)
- [Request body](https://developers.google.com/assistant/actions/api/reference/rest/v2/projects.preview/write#body.request_body)
  - [JSON representation](https://developers.google.com/assistant/actions/api/reference/rest/v2/projects.preview/write#body.request_body.SCHEMA_REPRESENTATION)
- [Response body](https://developers.google.com/assistant/actions/api/reference/rest/v2/projects.preview/write#body.response_body)
  - [JSON representation](https://developers.google.com/assistant/actions/api/reference/rest/v2/projects.preview/write#body.Preview.SCHEMA_REPRESENTATION)
- [ContentFromDraft](https://developers.google.com/assistant/actions/api/reference/rest/v2/projects.preview/write#ContentFromDraft)
- [ContentFromSubmittedVersion](https://developers.google.com/assistant/actions/api/reference/rest/v2/projects.preview/write#ContentFromSubmittedVersion)
  - [JSON representation](https://developers.google.com/assistant/actions/api/reference/rest/v2/projects.preview/write#ContentFromSubmittedVersion.SCHEMA_REPRESENTATION)
- [PreviewSettings](https://developers.google.com/assistant/actions/api/reference/rest/v2/projects.preview/write#PreviewSettings)
  - [JSON representation](https://developers.google.com/assistant/actions/api/reference/rest/v2/projects.preview/write#PreviewSettings.SCHEMA_REPRESENTATION)

Updates the user's project preview based on the model.

### HTTP request

`POST https://actions.googleapis.com/v2/{parent=projects/*}/preview:write`

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

### Path parameters

| Parameters ||
|---|---|
| `parent` | `string` Required. The parent resource name in the format `projects/{project}`. The `{project}` is the cloud project ID associated with the project. |

### Request body

The request body contains data with the following structure:

| JSON representation ||
|---|---|
| ``` { "previewSettings": { object (`https://developers.google.com/assistant/actions/api/reference/rest/v2/projects.preview/write#PreviewSettings`) }, // Union field `source` can be only one of the following: "files": { object (`https://developers.google.com/assistant/actions/api/reference/rest/v2/Files`) }, "draft": { object (`https://developers.google.com/assistant/actions/api/reference/rest/v2/projects.preview/write#ContentFromDraft`) }, "submittedVersion": { object (`https://developers.google.com/assistant/actions/api/reference/rest/v2/projects.preview/write#ContentFromSubmittedVersion`) } // End of list of possible types for union field `source`. } ``` |

| Fields ||
|---|---|---|
| `previewSettings` | ``object (`https://developers.google.com/assistant/actions/api/reference/rest/v2/projects.preview/write#PreviewSettings`)`` Required. The settings for updating the user's preview. |
| Union field `source`. Data source used to created the preview. `source` can be only one of the following: |||
| `files` | ``object (`https://developers.google.com/assistant/actions/api/reference/rest/v2/Files`)`` List of files sent to the server at a time. This is a list of config files or data files. 1. The first request must be a ConfigFiles. 2. The first request must have a ConfigFile with 'settings'. 3. The first request must have a ConfigFile with 'manifest'. 4. The webhook ConfigFile corresponding to inline cloud function must be streamed before the DataFile corresponding to its source code. |
| `draft` | ``object (`https://developers.google.com/assistant/actions/api/reference/rest/v2/projects.preview/write#ContentFromDraft`)`` Content sourced from the project draft. |
| `submittedVersion` | ``object (`https://developers.google.com/assistant/actions/api/reference/rest/v2/projects.preview/write#ContentFromSubmittedVersion`)`` Content sourced from the an exiting version. |

### Response body

If successful, the response body contains data with the following structure:
Definition of preview resource.

| JSON representation ||
|---|---|
| ``` { "name": string, "validationResults": { object (`https://developers.google.com/assistant/actions/api/reference/rest/v2/ValidationResults`) }, "simulatorUrl": string } ``` |

| Fields ||
|---|---|
| `name` | `string` The unique identifier of the preview. Format: `projects/{project}/preview` |
| `validationResults` | ``object (`https://developers.google.com/assistant/actions/api/reference/rest/v2/ValidationResults`)`` Validation results associated with the user project preview content. |
| `simulatorUrl` | `string` The simulator URL to test the user preview. |

## ContentFromDraft

Indicates the preview content will be coming from the Draft.

## ContentFromSubmittedVersion

Indicates the preview content will be coming from an exiting version.

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

| Fields ||
|---|---|
| `version` | `string` Required. Submitted version of the project to be used to create a preview. Format: `projects/{project}/versions/{version}` |

## PreviewSettings

Settings for updating the preview.

| JSON representation ||
|---|---|
| ``` { "sandbox": boolean } ``` |

| Fields ||
|---|---|
| `sandbox` | `boolean` Indicates whether or not to run certain operations, such as transactions, in sandbox mode. By default, preview requests run these operations in sandbox mode. In other words, the default value for `sandbox` is `true`. |