[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["很难理解","hardToUnderstand","thumb-down"],["信息或示例代码不正确","incorrectInformationOrSampleCode","thumb-down"],["没有我需要的信息/示例","missingTheInformationSamplesINeed","thumb-down"],["翻译问题","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-08-17。"],[],[],null,["# Long-running operations\n\nSome methods of the Video Intelligence API return a long-running\noperation. These methods are asynchronous, and the operation may not be\ncompleted when the method returns a response.\n| **Note:** Video Intelligence API does not support the `PageToken`, or `pageSize` parameters.\n\nGet an operation status\n-----------------------\n\nYou can check the status of a long-running task ([detecting shot changes](/video-intelligence/docs/analyze-shots))\nusing the operation name.\n**Note:** When using the Web UI you can monitor the status in the **Status** column of the list page. \n\n### REST\n\n\nBefore using any of the request data,\nmake the following replacements:\n\n- \u003cvar translate=\"no\"\u003eOPERATION_NAME\u003c/var\u003e: the `name` field returned from the call to Video Intelligence API. This is a value in the format: \n `projects/`\u003cvar translate=\"no\"\u003ePROJECT_NUMBER\u003c/var\u003e`/locations/`\u003cvar translate=\"no\"\u003eLOCATION_ID\u003c/var\u003e`/operations/`\u003cvar translate=\"no\"\u003eOPERATION_ID\u003c/var\u003e, \n where:\n - \u003cvar translate=\"no\"\u003ePROJECT_NUMBER\u003c/var\u003e is the [number](https://cloud.google.com/resource-manager/docs/creating-managing-projects#identifying_projects) of your Google Cloud project,\n - \u003cvar translate=\"no\"\u003eLOCATION_ID\u003c/var\u003e is the cloud region where annotation took place (for example: `us-east1`, `us-west1`, `europe-west1`, `asia-east1`),\n - \u003cvar translate=\"no\"\u003eOPERATION_ID\u003c/var\u003e is the ID of the long-running operation.\n\n\nHTTP method and URL:\n\n```\nGET https://videointelligence.googleapis.com/v1/OPERATION_NAME\n```\n\nTo send your request, expand one of these options:\n\n#### curl (Linux, macOS, or Cloud Shell)\n\n| **Note:** The following command assumes that you have logged in to the `gcloud` CLI with your user account by running [`gcloud init`](/sdk/gcloud/reference/init) or [`gcloud auth login`](/sdk/gcloud/reference/auth/login) , or by using [Cloud Shell](/shell/docs), which automatically logs you into the `gcloud` CLI . You can check the currently active account by running [`gcloud auth list`](/sdk/gcloud/reference/auth/list).\n\n\nExecute the following command:\n\n```\ncurl -X GET \\\n -H \"Authorization: Bearer $(gcloud auth print-access-token)\" \\\n -H \"x-goog-user-project: PROJECT_NUMBER\" \\\n \"https://videointelligence.googleapis.com/v1/OPERATION_NAME\"\n```\n\n#### PowerShell (Windows)\n\n| **Note:** The following command assumes that you have logged in to the `gcloud` CLI with your user account by running [`gcloud init`](/sdk/gcloud/reference/init) or [`gcloud auth login`](/sdk/gcloud/reference/auth/login) . You can check the currently active account by running [`gcloud auth list`](/sdk/gcloud/reference/auth/list).\n\n\nExecute the following command:\n\n```\n$cred = gcloud auth print-access-token\n$headers = @{ \"Authorization\" = \"Bearer $cred\"; \"x-goog-user-project\" = \"PROJECT_NUMBER\" }\n\nInvoke-WebRequest `\n -Method GET `\n -Headers $headers `\n -Uri \"https://videointelligence.googleapis.com/v1/OPERATION_NAME\" | Select-Object -Expand Content\n```\n\nYou should receive a JSON response similar to the following:\n\n```\n{\n \"name\": \"projects/PROJECT_NUMBER/locations/LOCATION_ID/operations/OPERATION_ID\",\n \"metadata\": {\n \"@type\": \"type.googleapis.com/google.cloud.videointelligence.v1p3beta1.AnnotateVideoProgress\",\n \"annotationProgress\": [\n {\n \"inputUri\": \"INPUT_URI\",\n \"progressPercent\": 100,\n \"startTime\": \"2020-05-12T19:36:09.110351Z\",\n \"updateTime\": \"2020-05-12T19:36:17.519069Z\"\n }\n ]\n },\n \"done\": true,\n \"response\": {\n \"@type\": \"type.googleapis.com/google.cloud.videointelligence.v1p3beta1.AnnotateVideoResponse\",\n \"annotationResults\": [\n {\n ...\n }\n ]\n }\n}\n```\n\n\u003cbr /\u003e\n\nCancel an operation\n-------------------\n\nYou can cancel a long-running operation using the operation ID. However,\ncancellation is not guaranteed to succeed. \n\n### REST\n\n\nBefore using any of the request data,\nmake the following replacements:\n\n- \u003cvar translate=\"no\"\u003eOPERATION_ID\u003c/var\u003e: provided in the response when you started the operation, \n for example `3326639765503758657` from `projects/754177431483/locations/us-west1/operations/3326639765503758657`\n- Note:\n - \u003cvar translate=\"no\"\u003ePROJECT_NUMBER\u003c/var\u003e: your GCP project ID\n - \u003cvar translate=\"no\"\u003eLOCATION_ID\u003c/var\u003e: 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.\n\n\nHTTP method and URL:\n\n```\nPOST https://videointelligence.googleapis.com/v1/projects/PROJECT_NUMBER/locations/LOCATION_ID/operations/OPERATION_ID:cancel\n```\n\nTo send your request, expand one of these options:\n\n#### curl (Linux, macOS, or Cloud Shell)\n\n| **Note:** The following command assumes that you have logged in to the `gcloud` CLI with your user account by running [`gcloud init`](/sdk/gcloud/reference/init) or [`gcloud auth login`](/sdk/gcloud/reference/auth/login) , or by using [Cloud Shell](/shell/docs), which automatically logs you into the `gcloud` CLI . You can check the currently active account by running [`gcloud auth list`](/sdk/gcloud/reference/auth/list).\n\n\nExecute the following command:\n\n```\ncurl -X POST \\\n -H \"Authorization: Bearer $(gcloud auth print-access-token)\" \\\n -H \"x-goog-user-project: PROJECT_NUMBER\" \\\n -H \"Content-Type: application/json; charset=utf-8\" \\\n -d \"\" \\\n \"https://videointelligence.googleapis.com/v1/projects/PROJECT_NUMBER/locations/LOCATION_ID/operations/OPERATION_ID:cancel\"\n```\n\n#### PowerShell (Windows)\n\n| **Note:** The following command assumes that you have logged in to the `gcloud` CLI with your user account by running [`gcloud init`](/sdk/gcloud/reference/init) or [`gcloud auth login`](/sdk/gcloud/reference/auth/login) . You can check the currently active account by running [`gcloud auth list`](/sdk/gcloud/reference/auth/list).\n\n\nExecute the following command:\n\n```\n$cred = gcloud auth print-access-token\n$headers = @{ \"Authorization\" = \"Bearer $cred\"; \"x-goog-user-project\" = \"PROJECT_NUMBER\" }\n\nInvoke-WebRequest `\n -Method POST `\n -Headers $headers `\n -Uri \"https://videointelligence.googleapis.com/v1/projects/PROJECT_NUMBER/locations/LOCATION_ID/operations/OPERATION_ID:cancel\" | Select-Object -Expand Content\n```\n\nYou should receive a successful status code (2xx) and an empty response.\n\n\u003cbr /\u003e"]]