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

Before using any of the request data, 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

Before using any of the request data, 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.

Create a Mobile Website
View Site in Mobile | Classic
Share by: