The Vision Warehouse API allows you to manage Vision Warehouse resources using the command line.
A connected warehouse (corpus
) in a data-ingesting deployed app is a resource
in your Google Cloud project. Use the following commands to manage
these resources.
Create a corpus resource
Streaming video corpus
The search_capability_setting
field is not supported. The default_ttl
field is required and it needs to be less than 10 years.
To create a corpora resource, send a POST request by using the
projects.locations.corpora.create
method.
Before using any of the request data, make the following replacements:
- REGIONALIZED_ENDPOINT: Endpoint might include a prefix matching the
LOCATION_ID
such aseurope-west4-
. See more about regionalized endpoints. - PROJECT_NUMBER: Your Google Cloud project number.
- LOCATION_ID: The region where you are using
Vertex AI Vision. For example:
us-central1
,europe-west4
. See available regions. - DISPLAY_NAME: Display name for the warehouse.
- WAREHOUSE_DESCRIPTION: The description of the warehouse (
corpus
). - TIME_TO_LIVE: The amount of time to live (TTL) for all assets under a corpus, or
the TTL of a specific asset. For example, for a corpus with assets with a TTL of 100 days,
provide the value
8640000
(seconds).
HTTP method and URL:
POST https://warehouse-visionai.googleapis.com /v1/projects/PROJECT_NUMBER /locations/LOCATION_ID /corpora
Request JSON body:
{ "display_name": "DISPLAY_NAME ", "description": "WAREHOUSE_DESCRIPTION ", "type": "STREAM_VIDEO", "default_ttl": { "seconds":TIME_TO_LIVE } }
To send your request, choose one of these options:
Save the request body in a file named request.json
,
and execute the following command:
curl -X POST \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json; charset=utf-8" \
-d @request.json \
"https://warehouse-visionai.googleapis.com /v1/projects/PROJECT_NUMBER /locations/LOCATION_ID /corpora"
Save the request body in a file named request.json
,
and execute the following command:
$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }
Invoke-WebRequest `
-Method POST `
-Headers $headers `
-ContentType: "application/json; charset=utf-8" `
-InFile request.json `
-Uri "https://warehouse-visionai.googleapis.com /v1/projects/PROJECT_NUMBER /locations/LOCATION_ID /corpora" | Select-Object -Expand Content
You should receive a JSON response similar to the following:
{ "name": "projects/PROJECT_NUMBER /locations/LOCATION_ID /warehouseoperations/OPERATION_ID ", "metadata": { "@type": "type.googleapis.com/google.cloud.visionai.v1.CreateCorpusMetadata" }, "done": true, "response": { "@type": "type.googleapis.com/google.cloud.visionai.v1.Corpus", "name": "projects/PROJECT_NUMBER /locations/LOCATION_ID /corpora/CORPUS_ID ", "displayName": "DISPLAY_NAME ", "description": "WAREHOUSE_DESCRIPTION ", "type": "STREAM_VIDEO", "defaultTtl": "TIME_TO_LIVE " } }
Image corpus
The default_ttl
field is not supported.
To create a corpora resource, send a POST request by using the
projects.locations.corpora.create
method.
Before using any of the request data, make the following replacements:
- REGIONALIZED_ENDPOINT: Endpoint might include a prefix matching the
LOCATION_ID
such aseurope-west4-
. See more about regionalized endpoints. - PROJECT_NUMBER: Your Google Cloud project number.
- LOCATION_ID: The region where you are using
Vertex AI Vision. For example:
us-central1
,europe-west4
. See available regions. - DISPLAY_NAME: Display name for the warehouse.
- WAREHOUSE_DESCRIPTION: The description of the warehouse (
corpus
).
HTTP method and URL:
POST https://warehouse-visionai.googleapis.com /v1/projects/PROJECT_NUMBER /locations/LOCATION_ID /corpora
Request JSON body:
{ "display_name": "DISPLAY_NAME ", "description": "WAREHOUSE_DESCRIPTION ", "type": "IMAGE", "search_capability_setting": { "search_capabilities": { "type": "EMBEDDING_SEARCH" } } }
To send your request, choose one of these options:
Save the request body in a file named request.json
,
and execute the following command:
curl -X POST \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json; charset=utf-8" \
-d @request.json \
"https://warehouse-visionai.googleapis.com /v1/projects/PROJECT_NUMBER /locations/LOCATION_ID /corpora"
Save the request body in a file named request.json
,
and execute the following command:
$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }
Invoke-WebRequest `
-Method POST `
-Headers $headers `
-ContentType: "application/json; charset=utf-8" `
-InFile request.json `
-Uri "https://warehouse-visionai.googleapis.com /v1/projects/PROJECT_NUMBER /locations/LOCATION_ID /corpora" | Select-Object -Expand Content
You should receive a JSON response similar to the following:
{ "name": "projects/PROJECT_NUMBER /locations/LOCATION_ID /warehouseoperations/OPERATION_ID ", "metadata": { "@type": "type.googleapis.com/google.cloud.visionai.v1.CreateCorpusMetadata" }, "done": true, "response": { "@type": "type.googleapis.com/google.cloud.visionai.v1.Corpus", "name": "projects/PROJECT_NUMBER /locations/LOCATION_ID /corpora/CORPUS_ID ", "displayName": "DISPLAY_NAME ", "description": "WAREHOUSE_DESCRIPTION ", "type": "IMAGE", "search_capability_setting": { "search_capabilities": { "type": "EMBEDDING_SEARCH" } } } }
Batch video corpus
The default_ttl
field is not supported.
To create a corpora resource, send a POST request by using the
projects.locations.corpora.create
method.
Before using any of the request data, make the following replacements:
- REGIONALIZED_ENDPOINT: Endpoint might include a prefix matching the
LOCATION_ID
such aseurope-west4-
. See more about regionalized endpoints. - PROJECT_NUMBER: Your Google Cloud project number.
- LOCATION_ID: The region where you are using
Vertex AI Vision. For example:
us-central1
,europe-west4
. See available regions. - DISPLAY_NAME: Display name for the warehouse.
- WAREHOUSE_DESCRIPTION: The description of the warehouse (
corpus
).
HTTP method and URL:
POST https://warehouse-visionai.googleapis.com /v1/projects/PROJECT_NUMBER /locations/LOCATION_ID /corpora
Request JSON body:
{ "display_name": "DISPLAY_NAME ", "description": "WAREHOUSE_DESCRIPTION ", "type": "VIDEO_ON_DEMAND", "search_capability_setting": { "search_capabilities": { "type": "EMBEDDING_SEARCH" } } }
To send your request, choose one of these options:
Save the request body in a file named request.json
,
and execute the following command:
curl -X POST \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json; charset=utf-8" \
-d @request.json \
"https://warehouse-visionai.googleapis.com /v1/projects/PROJECT_NUMBER /locations/LOCATION_ID /corpora"
Save the request body in a file named request.json
,
and execute the following command:
$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }
Invoke-WebRequest `
-Method POST `
-Headers $headers `
-ContentType: "application/json; charset=utf-8" `
-InFile request.json `
-Uri "https://warehouse-visionai.googleapis.com /v1/projects/PROJECT_NUMBER /locations/LOCATION_ID /corpora" | Select-Object -Expand Content
You should receive a JSON response similar to the following:
{ "name": "projects/PROJECT_NUMBER /locations/LOCATION_ID /warehouseoperations/OPERATION_ID ", "metadata": { "@type": "type.googleapis.com/google.cloud.visionai.v1.CreateCorpusMetadata" }, "done": true, "response": { "@type": "type.googleapis.com/google.cloud.visionai.v1.Corpus", "name": "projects/PROJECT_NUMBER /locations/LOCATION_ID /corpora/CORPUS_ID ", "displayName": "DISPLAY_NAME ", "description": "WAREHOUSE_DESCRIPTION ", "type": "VIDEO_ON_DEMAND", "search_capability_setting": { "search_capabilities": { "type": "EMBEDDING_SEARCH" } } } }
Update a corpus resource
Streaming video corpus
The search_capability_setting
field is not supported.
To update a corpora resource, send a PATCH request by using the
projects.locations.corpora.patch
method.
Before using any of the request data, make the following replacements:
- REGIONALIZED_ENDPOINT: Endpoint might include a prefix matching the
LOCATION_ID
such aseurope-west4-
. See more about regionalized endpoints. - PROJECT_NUMBER: Your Google Cloud project number.
- LOCATION_ID: The region where you are using
Vertex AI Vision. For example:
us-central1
,europe-west4
. See available regions. - CORPUS_ID: The ID of your target corpus.
?updateMask=fieldToUpdate
: One of the available fields you can apply anupdateMask
to. Specify the corresponding new field value in the request body. This new value replaces the existing field value. Available fields:- Display name:
?updateMask=display_name
- Description:
?updateMask=description
- Default time-to-live (TTL):
?updateMask=default_ttl
- Update all fields:
?updateMask=*
- Display name:
- UPDATED_FIELD_VALUE: A new value for the specified field. In this example, a new user-provided display name for the warehouse resource.
HTTP method and URL:
PATCH https://warehouse-visionai.googleapis.com /v1/projects/PROJECT_NUMBER /locations/LOCATION_ID /corpora/CORPUS_ID ?update_mask=display_name
Request JSON body:
{ "displayName": "UPDATED_FIELD_VALUE ", "description": "Original description", "defaultTtl": { "seconds": "7800" } }
To send your request, choose one of these options:
Save the request body in a file named request.json
,
and execute the following command:
curl -X PATCH \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json; charset=utf-8" \
-d @request.json \
"https://warehouse-visionai.googleapis.com /v1/projects/PROJECT_NUMBER /locations/LOCATION_ID /corpora/CORPUS_ID ?update_mask=display_name "
Save the request body in a file named request.json
,
and execute the following command:
$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }
Invoke-WebRequest `
-Method PATCH `
-Headers $headers `
-ContentType: "application/json; charset=utf-8" `
-InFile request.json `
-Uri "https://warehouse-visionai.googleapis.com /v1/projects/PROJECT_NUMBER /locations/LOCATION_ID /corpora/CORPUS_ID ?update_mask=display_name " | Select-Object -Expand Content
You should receive a JSON response similar to the following:
{ "name": "projects/PROJECT_ID /locations/LOCATION_ID /corpora/CORPORA_ID ", "displayName": "UPDATED_FIELD_VALUE ", "description": "Original description", "defaultTtl": "7800s" }
Image corpus
The default_ttl
field is not supported.
To update a corpora resource, send a PATCH request by using the
projects.locations.corpora.patch
method.
Before using any of the request data, make the following replacements:
- REGIONALIZED_ENDPOINT: Endpoint might include a prefix matching the
LOCATION_ID
such aseurope-west4-
. See more about regionalized endpoints. - PROJECT_NUMBER: Your Google Cloud project number.
- LOCATION_ID: The region where you are using
Vertex AI Vision. For example:
us-central1
,europe-west4
. See available regions. - CORPUS_ID: The ID of your target corpus.
?updateMask=fieldToUpdate
: One of the available fields you can apply anupdateMask
to. Specify the corresponding new field value in the request body. This new value replaces the existing field value. Available fields:- Display name:
?updateMask=display_name
- Description:
?updateMask=description
- Default time-to-live (TTL):
?updateMask=default_ttl
- Update all fields:
?updateMask=*
- Display name:
- UPDATED_FIELD_VALUE: A new value for the specified field. In this example, a new user-provided display name for the warehouse resource.
HTTP method and URL:
PATCH https://warehouse-visionai.googleapis.com /v1/projects/PROJECT_NUMBER /locations/LOCATION_ID /corpora/CORPUS_ID ?update_mask=display_name
Request JSON body:
{ "displayName": "UPDATED_FIELD_VALUE ", "description": "Original description" }
To send your request, choose one of these options:
Save the request body in a file named request.json
,
and execute the following command:
curl -X PATCH \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json; charset=utf-8" \
-d @request.json \
"https://warehouse-visionai.googleapis.com /v1/projects/PROJECT_NUMBER /locations/LOCATION_ID /corpora/CORPUS_ID ?update_mask=display_name "
Save the request body in a file named request.json
,
and execute the following command:
$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }
Invoke-WebRequest `
-Method PATCH `
-Headers $headers `
-ContentType: "application/json; charset=utf-8" `
-InFile request.json `
-Uri "https://warehouse-visionai.googleapis.com /v1/projects/PROJECT_NUMBER /locations/LOCATION_ID /corpora/CORPUS_ID ?update_mask=display_name " | Select-Object -Expand Content
You should receive a JSON response similar to the following:
{ "name": "projects/PROJECT_ID /locations/LOCATION_ID /corpora/CORPORA_ID ", "displayName": "UPDATED_FIELD_VALUE ", "description": "Original description" }
Batch video corpus
The default_ttl
field is not supported.
To update a corpora resource, send a PATCH request by using the
projects.locations.corpora.patch
method.
Before using any of the request data, make the following replacements:
- REGIONALIZED_ENDPOINT: Endpoint might include a prefix matching the
LOCATION_ID
such aseurope-west4-
. See more about regionalized endpoints. - PROJECT_NUMBER: Your Google Cloud project number.
- LOCATION_ID: The region where you are using
Vertex AI Vision. For example:
us-central1
,europe-west4
. See available regions. - CORPUS_ID: The ID of your target corpus.
?updateMask=fieldToUpdate
: One of the available fields you can apply anupdateMask
to. Specify the corresponding new field value in the request body. This new value replaces the existing field value. Available fields:- Display name:
?updateMask=display_name
- Description:
?updateMask=description
- Default time-to-live (TTL):
?updateMask=default_ttl
- Update all fields:
?updateMask=*
- Display name:
- UPDATED_FIELD_VALUE: A new value for the specified field. In this example, a new user-provided display name for the warehouse resource.
HTTP method and URL:
PATCH https://warehouse-visionai.googleapis.com /v1/projects/PROJECT_NUMBER /locations/LOCATION_ID /corpora/CORPUS_ID ?update_mask=display_name
Request JSON body:
{ "displayName": "UPDATED_FIELD_VALUE ", "description": "Original description" }
To send your request, choose one of these options:
Save the request body in a file named request.json
,
and execute the following command:
curl -X PATCH \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json; charset=utf-8" \
-d @request.json \
"https://warehouse-visionai.googleapis.com /v1/projects/PROJECT_NUMBER /locations/LOCATION_ID /corpora/CORPUS_ID ?update_mask=display_name "
Save the request body in a file named request.json
,
and execute the following command:
$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }
Invoke-WebRequest `
-Method PATCH `
-Headers $headers `
-ContentType: "application/json; charset=utf-8" `
-InFile request.json `
-Uri "https://warehouse-visionai.googleapis.com /v1/projects/PROJECT_NUMBER /locations/LOCATION_ID /corpora/CORPUS_ID ?update_mask=display_name " | Select-Object -Expand Content
You should receive a JSON response similar to the following:
{ "name": "projects/PROJECT_ID /locations/LOCATION_ID /corpora/CORPORA_ID ", "displayName": "UPDATED_FIELD_VALUE ", "description": "Original description" }
List all corpora
To list all corpora (warehouses), send a GET request by using the
projects.locations.corpora.list
method.
Before using any of the request data, make the following replacements:
- REGIONALIZED_ENDPOINT: Endpoint might include a prefix matching the
LOCATION_ID
such aseurope-west4-
. See more about regionalized endpoints. - PROJECT_NUMBER: Your Google Cloud project number.
- LOCATION_ID: The region where you are using
Vertex AI Vision. For example:
us-central1
,europe-west4
. See available regions.
HTTP method and URL:
GET https://warehouse-visionai.googleapis.com /v1/projects/PROJECT_NUMBER /locations/LOCATION_ID /corpora
To send your request, choose one of these options:
Execute the following command:
curl -X GET \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
"https://warehouse-visionai.googleapis.com /v1/projects/PROJECT_NUMBER /locations/LOCATION_ID /corpora"
Execute the following command:
$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }
Invoke-WebRequest `
-Method GET `
-Headers $headers `
-Uri "https://warehouse-visionai.googleapis.com /v1/projects/PROJECT_NUMBER /locations/LOCATION_ID /corpora" | Select-Object -Expand Content
You should receive a JSON response similar to the following:
{ "corpora": [ { "name": "projects/PROJECT_NUMBER /locations/LOCATION_ID /corpora/CORPUS_ID1 ", "displayName": "CORPUS_DISPLAYNAME1 ", "description": "CORPUS_DESCRIPTION1 " }, { "name": "projects/PROJECT_NUMBER /locations/LOCATION_ID /corpora/CORPUS_ID2 ", "displayName": "CORPUS_DISPLAYNAME2 ", "description": "CORPUS_DESCRIPTION2 ", "defaultTtl": "8640000s" }, ], "nextPageToken": "ChM3MDk3NTk3Nzc2OTk3NDA3OTkzEAo" }
Get a corpus resource
To get details about a corpus (warehouse), send a GET request by using the
projects.locations.corpora.get
method.
Before using any of the request data, make the following replacements:
- REGIONALIZED_ENDPOINT: Endpoint might include a prefix matching the
LOCATION_ID
such aseurope-west4-
. See more about regionalized endpoints. - PROJECT_NUMBER: Your Google Cloud project number.
- LOCATION_ID: The region where you are using
Vertex AI Vision. For example:
us-central1
,europe-west4
. See available regions. - CORPUS_ID: The ID of your target corpus.
HTTP method and URL:
GET https://warehouse-visionai.googleapis.com /v1/projects/PROJECT_NUMBER /locations/LOCATION_ID /corpora/CORPUS_ID
To send your request, choose one of these options:
Execute the following command:
curl -X GET \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
"https://warehouse-visionai.googleapis.com /v1/projects/PROJECT_NUMBER /locations/LOCATION_ID /corpora/CORPUS_ID "
Execute the following command:
$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }
Invoke-WebRequest `
-Method GET `
-Headers $headers `
-Uri "https://warehouse-visionai.googleapis.com /v1/projects/PROJECT_NUMBER /locations/LOCATION_ID /corpora/CORPUS_ID " | Select-Object -Expand Content
You should receive a JSON response similar to the following:
{ "name": "projects/PROJECT_NUMBER /locations/LOCATION_ID /corpora/CORPUS_ID ", "displayName": "CORPUS_DISPLAYNAME ", "description": "CORPUS_DESCRIPTION ", "defaultTtl": "8640000s" }
Delete a corpus resource
Deletes the corpus using the following code sample. To delete the corpus, all of its assets must first be deleted.
The following code sample deletes a corpus
resource using the
projects.locations.corpora.delete
method.
Before using any of the request data, make the following replacements:
- REGIONALIZED_ENDPOINT: Endpoint might include a prefix matching the
LOCATION_ID
such aseurope-west4-
. See more about regionalized endpoints. - PROJECT_NUMBER: Your Google Cloud project number.
- LOCATION_ID: The region where you are using
Vertex AI Vision. For example:
us-central1
,europe-west4
. See available regions. - CORPUS_ID: The ID of your target corpus.
HTTP method and URL:
DELETE https://warehouse-visionai.googleapis.com /v1/projects/PROJECT_NUMBER /locations/LOCATION_ID /corpora/CORPUS_ID
To send your request, choose one of these options:
Execute the following command:
curl -X DELETE \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
"https://warehouse-visionai.googleapis.com /v1/projects/PROJECT_NUMBER /locations/LOCATION_ID /corpora/CORPUS_ID "
Execute the following command:
$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }
Invoke-WebRequest `
-Method DELETE `
-Headers $headers `
-Uri "https://warehouse-visionai.googleapis.com /v1/projects/PROJECT_NUMBER /locations/LOCATION_ID /corpora/CORPUS_ID " | Select-Object -Expand Content
You should receive a JSON response similar to the following:
{}