Long-running operations

Some methods of AutoML Video Intelligence return a long-running operation. These methods are asynchronous, and the operation may not be completed when the method returns a response.

Get an operation status

You can check the status of a long-running task (importing items into a dataset or training a model) using the operation name.

REST

Before using any of the request data, make the following replacements:

  • project-number: your project number
  • location-id: for example, us-central1
  • operation id: provided in the response when you started the operation, for example for Classification: VCN123...., and for Object tracking: VOT123....

HTTP method and URL:

GET https://automl.googleapis.com/v1beta1/projects/project-number/locations/location-id/operations/operation-id

To send your request, choose one of these options:

curl

Execute the following command:

curl -X GET \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "x-goog-user-project: project-number" \
"https://automl.googleapis.com/v1beta1/projects/project-number/locations/location-id/operations/operation-id"

PowerShell

Execute the following command:

$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred"; "x-goog-user-project" = "project-number" }

Invoke-WebRequest `
-Method GET `
-Headers $headers `
-Uri "https://automl.googleapis.com/v1beta1/projects/project-number/locations/location-id/operations/operation-id" | Select-Object -Expand Content
The model-id is the ID of your model, from the response when you created the model. The ID is the last element of the name of your model. For example:
  • model name: projects/project-number/locations/location-id/models/model-id
  • model id: model-id

Cancel an operation

You can cancel a long-running operation using the operation ID. The cancellation is not guaranteed to succeed.

REST

Before using any of the request data, make the following replacements:

  • operation id: provided in the response when you started the operation,
    for example for Classification: VCN123...., and for Object tracking: VOT123....
  • Note:
    • project-number: your GCP project ID
    • location-id: the Cloud region where annotation should take place. Supported cloud regions are: us-east1, us-west1, europe-west1, asia-east1. If no region is specified, a region will be determined based on video file location.

HTTP method and URL:

POST https://automl.googleapis.com/v1beta1/projects/project-number/locations/location-id/operations/operation-id:cancel

To send your request, expand one of these options:

You should receive a successful status code (2xx) and an empty response.