Stay organized with collections
Save and categorize content based on your preferences.
Several operations you request are long-running, such as product set creation via bulk
import, purging a product set, and purging orphaned products. These types of requests will
return a JSON with an operation ID that you can use to get the status of the
operation.
For example, a batch delete (purge) request returns the following JSON:
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-28 UTC."],[],[],null,["# Getting an operation's status\n\nSeveral operations you request are long-running, such as product set creation via bulk\nimport, purging a product set, and purging orphaned products. These types of requests will\nreturn a JSON with an operation ID that you can use to get the status of the\noperation.\n\nFor example, a batch delete (`purge`) request returns the following JSON: \n\n```\n{\n\"name\": \"projects/project-id/locations/location-id/operations/bc4e1d412863e626\"\n}\n```\n\nIn this case, the operation ID is `bc4e1d412863e626`. The following samples\nshow how to get the status of this operation with this ID. \n\n### REST\n\n\nBefore using any of the request data,\nmake the following replacements:\n\n- \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e: Your Google Cloud project ID.\n- \u003cvar translate=\"no\"\u003eLOCATION_ID\u003c/var\u003e: A valid location identifier. Valid location identifiers are: `us-west1`, `us-east1`, `europe-west1`, and `asia-east1`.\n- \u003cvar translate=\"no\"\u003eOPERATION_ID\u003c/var\u003e: The ID of your operation. The ID is the last element of the name of your operation. For example:\n - operation name: `projects/`\u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e`/locations/`\u003cvar translate=\"no\"\u003eLOCATION_ID\u003c/var\u003e`/operations/`**bc4e1d412863e626**\n - operation id: **bc4e1d412863e626**\n\n\nHTTP method and URL:\n\n```\nGET https://vision.googleapis.com/v1/locations/location-id/operations/operation-id\n```\n\nTo send your request, choose one of these options: \n\n#### curl\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-id\" \\\n \"https://vision.googleapis.com/v1/locations/location-id/operations/operation-id\"\n```\n\n#### PowerShell\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-id\" }\n\nInvoke-WebRequest `\n -Method GET `\n -Headers $headers `\n -Uri \"https://vision.googleapis.com/v1/locations/location-id/operations/operation-id\" | Select-Object -Expand Content\n```\nYou should see output similar to the following for a completed **product set purge operation** : \n\n```\n{\n \"name\": \"locations/location-id/operations/operation-id\",\n \"metadata\": {\n \"@type\": \"type.googleapis.com/google.cloud.vision.v1.BatchOperationMetadata\",\n \"state\": \"SUCCESSFUL\",\n \"submitTime\": \"2019-09-04T15:58:39.131591882Z\",\n \"endTime\": \"2019-09-04T15:58:43.099020580Z\"\n },\n \"done\": true,\n \"response\": {\n \"@type\": \"type.googleapis.com/google.cloud.vision.v1.PurgeProductsRequest\",\n \"parent\": \"projects/project-id/locations/location-id\",\n \"productSetPurgeConfig\": {\n \"productSetId\": \"\u003cvar translate=\"no\"\u003eproject-set-id\u003c/var\u003e\"\n },\n \"force\": true\n }\n}\n```\n\nYou should see output similar to the following for a completed **purge orphaned products\noperation**:\n\n```\n{\n \"name\": \"locations/location-id/operations/operation-id\",\n \"metadata\": {\n \"@type\": \"type.googleapis.com/google.cloud.vision.v1.BatchOperationMetadata\",\n \"state\": \"SUCCESSFUL\",\n \"submitTime\": \"2019-09-04T16:08:38.278197397Z\",\n \"endTime\": \"2019-09-04T16:08:45.075778639Z\"\n },\n \"done\": true,\n \"response\": {\n \"@type\": \"type.googleapis.com/google.cloud.vision.v1.PurgeProductsRequest\",\n \"parent\": \"projects/project-id/locations/location-id\",\n \"deleteOrphanProducts\": true,\n \"force\": true\n }\n}\n```"]]