Long-running operations

Some methods of the Video Intelligence API 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 (detecting shot changes) using the operation name.

REST & CMD LINE

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

  • operation-name: the name field returned from the call to Video Intelligence API. This is a value in the format:
    projects/project-number/locations/location-id/operations/operation-id,
    where:
    • project-number is the number of your Google Cloud project,
    • location-id is the cloud region where annotation took place (for example: us-east1, us-west1, europe-west1, asia-east1),
    • operation-id is the ID of the long-running operation.

HTTP method and URL:

GET https://videointelligence.googleapis.com/v1/operation-name

To send your request, expand one of these options:

You should receive a JSON response similar to the following:

{
  "name": "projects/project-number/locations/location-id/operations/operation-id",
  "metadata": {
    "@type": "type.googleapis.com/google.cloud.videointelligence.v1p3beta1.AnnotateVideoProgress",
    "annotationProgress": [
      {
        "inputUri": "input-uri",
        "progressPercent": 100,
        "startTime": "2020-05-12T19:36:09.110351Z",
        "updateTime": "2020-05-12T19:36:17.519069Z"
      }
    ]
  },
  "done": true,
  "response": {
    "@type": "type.googleapis.com/google.cloud.videointelligence.v1p3beta1.AnnotateVideoResponse",
    "annotationResults": [
      {
        ...
      }
    ]
  }
}

Cancel an operation

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

REST & CMD LINE

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

  • operation id: provided in the response when you started the operation,
    for example 3326639765503758657 from projects/754177431483/locations/us-west1/operations/3326639765503758657
  • 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://videointelligence.googleapis.com/v1/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.