Method: projects.preview.write
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
HTTP 请求
POST https://actions.googleapis.com/v2/{parent=projects/*}/preview:write
网址采用 gRPC 转码语法。
路径参数
参数 |
parent |
string
必需。父级资源名称,格式为 projects/{project} 。{project} 是与项目关联的 Cloud 项目 ID。
|
请求正文
请求正文中包含结构如下的数据:
字段 |
previewSettings |
object (PreviewSettings )
必需。用于更新用户预览的设置。
|
联合字段 source 。用于创建预览的数据源。source 只能是下列其中一项: |
files |
object (Files )
每次发送到服务器的文件列表。这是配置文件或数据文件的列表。1. 第一个请求必须是 ConfigFiles。2. 第一个请求必须具有含“settings”的 ConfigFile。3. 第一个请求必须具有含“manifest”的 ConfigFile。4. 与内嵌 Cloud Functions 函数对应的 webhook ConfigFile 必须在与其源代码对应的 DataFile 之前进行流式传输。
|
draft |
object (ContentFromDraft )
内容源自项目草稿。
|
submittedVersion |
object (ContentFromSubmittedVersion )
内容源自现有版本。
|
响应正文
如果成功,响应正文将包含结构如下的数据:
JSON 表示法 |
{
"name": string,
"validationResults": {
object (ValidationResults )
},
"simulatorUrl": string
} |
字段 |
name |
string
预览的唯一标识符。格式:projects/{project}/preview
|
validationResults |
object (ValidationResults )
与用户项目预览内容相关联的验证结果。
|
simulatorUrl |
string
用于测试用户预览的模拟器网址。
|
ContentFromSubmittedVersion
JSON 表示法 |
{
"version": string
} |
字段 |
version |
string
必需。已提交的将用于创建预览的项目版本。格式:projects/{project}/versions/{version}
|
PreviewSettings
JSON 表示法 |
{
"sandbox": boolean
} |
字段 |
sandbox |
boolean
指示是否在沙盒模式下运行某些操作,例如事务。默认情况下,预览请求会在沙盒模式下运行这些操作。换句话说,sandbox 的默认值为 true 。
|
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-26。
[null,null,["最后更新时间 (UTC):2025-07-26。"],[[["\u003cp\u003eUpdates a user's project preview using either draft content, an existing version, or uploaded files.\u003c/p\u003e\n"],["\u003cp\u003eRequires specifying the project ID and the preview settings, which include an optional sandbox mode.\u003c/p\u003e\n"],["\u003cp\u003eThe request body must indicate the source of the preview content (draft, version, or files).\u003c/p\u003e\n"],["\u003cp\u003eA successful response provides the preview's name, validation results, and a simulator URL for testing.\u003c/p\u003e\n"],["\u003cp\u003eThe API uses gRPC Transcoding and expects the content to follow specific JSON structures for requests and responses.\u003c/p\u003e\n"]]],[],null,["# Method: projects.preview.write\n\n- [HTTP request](#body.HTTP_TEMPLATE)\n- [Path parameters](#body.PATH_PARAMETERS)\n- [Request body](#body.request_body)\n - [JSON representation](#body.request_body.SCHEMA_REPRESENTATION)\n- [Response body](#body.response_body)\n - [JSON representation](#body.Preview.SCHEMA_REPRESENTATION)\n- [ContentFromDraft](#ContentFromDraft)\n- [ContentFromSubmittedVersion](#ContentFromSubmittedVersion)\n - [JSON representation](#ContentFromSubmittedVersion.SCHEMA_REPRESENTATION)\n- [PreviewSettings](#PreviewSettings)\n - [JSON representation](#PreviewSettings.SCHEMA_REPRESENTATION)\n\nUpdates the user's project preview based on the model.\n\n### HTTP request\n\n`POST https://actions.googleapis.com/v2/{parent=projects/*}/preview:write`\n\nThe URL uses [gRPC Transcoding](https://google.aip.dev/127) syntax.\n\n### Path parameters\n\n| Parameters ||\n|----------|------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `parent` | `string` Required. The parent resource name in the format `projects/{project}`. The `{project}` is the cloud project ID associated with the project. |\n\n### Request body\n\nThe request body contains data with the following structure:\n\n| JSON representation ||\n|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|\n| ``` { \"previewSettings\": { object (/assistant/actions/api/reference/rest/v2/projects.preview/write#PreviewSettings) }, // Union field `source` can be only one of the following: \"files\": { object (/assistant/actions/api/reference/rest/v2/Files) }, \"draft\": { object (/assistant/actions/api/reference/rest/v2/projects.preview/write#ContentFromDraft) }, \"submittedVersion\": { object (/assistant/actions/api/reference/rest/v2/projects.preview/write#ContentFromSubmittedVersion) } // End of list of possible types for union field `source`. } ``` |\n\n| Fields ||\n|--------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|\n| `previewSettings` | `object (`[PreviewSettings](/assistant/actions/api/reference/rest/v2/projects.preview/write#PreviewSettings)`)` Required. The settings for updating the user's preview. |\n| Union field `source`. Data source used to created the preview. `source` can be only one of the following: |||\n| `files` | `object (`[Files](/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. |\n| `draft` | `object (`[ContentFromDraft](/assistant/actions/api/reference/rest/v2/projects.preview/write#ContentFromDraft)`)` Content sourced from the project draft. |\n| `submittedVersion` | `object (`[ContentFromSubmittedVersion](/assistant/actions/api/reference/rest/v2/projects.preview/write#ContentFromSubmittedVersion)`)` Content sourced from the an exiting version. |\n\n### Response body\n\nIf successful, the response body contains data with the following structure:\nDefinition of preview resource.\n\n| JSON representation ||\n|--------------------------------------------------------------------------------------------------------------------------------------------------|---|\n| ``` { \"name\": string, \"validationResults\": { object (/assistant/actions/api/reference/rest/v2/ValidationResults) }, \"simulatorUrl\": string } ``` |\n\n| Fields ||\n|---------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `name` | `string` The unique identifier of the preview. Format: `projects/{project}/preview` |\n| `validationResults` | `object (`[ValidationResults](/assistant/actions/api/reference/rest/v2/ValidationResults)`)` Validation results associated with the user project preview content. |\n| `simulatorUrl` | `string` The simulator URL to test the user preview. |\n\nContentFromDraft\n----------------\n\nIndicates the preview content will be coming from the Draft.\n\nContentFromSubmittedVersion\n---------------------------\n\nIndicates the preview content will be coming from an exiting version.\n\n| JSON representation ||\n|-------------------------------|---|\n| ``` { \"version\": string } ``` |\n\n| Fields ||\n|-----------|-------------------------------------------------------------------------------------------------------------------------------------|\n| `version` | `string` Required. Submitted version of the project to be used to create a preview. Format: `projects/{project}/versions/{version}` |\n\nPreviewSettings\n---------------\n\nSettings for updating the preview.\n\n| JSON representation ||\n|--------------------------------|---|\n| ``` { \"sandbox\": boolean } ``` |\n\n| Fields ||\n|-----------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `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`. |"]]