通过指定资产的 Cloud Storage URI 上传资产。对于视频仓库,调用此 API 的用户需要对 Cloud Storage 文件拥有读取权限。上传后,您可以通过 assets.generateRetrievalUrl API 检索该文件。默认情况下,该 API 只能检索仓库同一项目中的 Cloud Storage 文件。如需允许检索位于其他项目中的 Cloud Storage 文件,您需要找到 Vision AI 服务账号(前往 IAM,选中复选框以显示“包括 Google 提供的角色授权”,搜索“Cloud Vision AI Service Agent”),并向该服务账号授予对 Cloud Storage 文件的读取权限。
HTTP 请求
POST https://visionai.googleapis.com/v1/{name=projects/*/locations/*/corpora/*/assets/*}:upload
{// Union field source_form can be only one of the following:"assetGcsSource": {object (AssetGcsSource)},"assetContentData": {object (AssetContentData)}// End of list of possible types for union field source_form.}
[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["很难理解","hardToUnderstand","thumb-down"],["信息或示例代码不正确","incorrectInformationOrSampleCode","thumb-down"],["没有我需要的信息/示例","missingTheInformationSamplesINeed","thumb-down"],["翻译问题","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-03-04。"],[],[],null,["# Method: projects.locations.corpora.assets.upload\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- [Authorization scopes](#body.aspect)\n- [IAM Permissions](#body.aspect_1)\n- [AssetSource](#AssetSource)\n - [JSON representation](#AssetSource.SCHEMA_REPRESENTATION)\n- [AssetContentData](#AssetContentData)\n - [JSON representation](#AssetContentData.SCHEMA_REPRESENTATION)\n\nUpload asset by specifing the asset Cloud Storage uri. For video warehouse, it requires users who call this API have read access to the cloud storage file. Once it is uploaded, it can be retrieved by assets.generateRetrievalUrl API which by default, only can retrieve cloud storage files from the same project of the warehouse. To allow retrieval cloud storage files that are in a separate project, it requires to find the vision ai service account (Go to IAM, check checkbox to show \"Include Google-provided role grants\", search for \"Cloud Vision AI Service Agent\") and grant the read access of the cloud storage files to that service account.\n\n### HTTP request\n\n`POST https://visionai.googleapis.com/v1/{name=projects/*/locations/*/corpora/*/assets/*}:upload`\n\nThe URL uses [gRPC Transcoding](https://google.aip.dev/127) syntax.\n\n### Path parameters\n\n### Request body\n\nThe request body contains data with the following structure:\n\n### Response body\n\nIf successful, the response body contains an instance of [Operation](/vision-ai/docs/reference/rest/Shared.Types/ListOperationsResponse#Operation).\n\n### Authorization scopes\n\nRequires the following OAuth scope:\n\n- `https://www.googleapis.com/auth/cloud-platform`\n\nFor more information, see the [Authentication Overview](https://cloud.google.com/docs/authentication/).\n\n### IAM Permissions\n\nRequires the following [IAM](https://cloud.google.com/iam/docs) permission on the `name` resource:\n\n- `visionai.assets.upload`\n\nFor more information, see the [IAM documentation](https://cloud.google.com/iam/docs).\n\nAssetSource\n-----------\n\nThe source of the asset.\n\nAssetContentData\n----------------\n\nThe content of the asset."]]