Method: projects.locations.corpora.assets.upload

Upload 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.

HTTP request

POST https://visionai.googleapis.com/v1alpha1/{name=projects/*/locations/*/corpora/*/assets/*}:upload

The URL uses gRPC Transcoding syntax.

Path parameters

Parameters
name

string

Required. The resource name of the asset to upload. Format: projects/{project_number}/locations/{locationId}/corpora/{corpus_id}/assets/{assetId}

Request body

The request body contains data with the following structure:

JSON representation
{
  "assetSource": {
    object (AssetSource)
  }
}
Fields
assetSource

object (AssetSource)

The source of the asset.

Response body

If successful, the response body contains an instance of Operation.

Authorization scopes

Requires the following OAuth scope:

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

For more information, see the Authentication Overview.

IAM Permissions

Requires the following IAM permission on the name resource:

  • visionai.assets.upload

For more information, see the IAM documentation.

AssetSource

The source of the asset.

JSON representation
{

  // 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.
}
Fields

Union field source_form.

source_form can be only one of the following:

assetGcsSource

object (AssetGcsSource)

The source of the asset is from Cloud Storage.

assetContentData

object (AssetContentData)

The source of the asset is from content bytes.

AssetContentData

The content of the asset.

JSON representation
{
  "assetContentData": string
}
Fields
assetContentData

string (bytes format)

A base64-encoded string.