Long-running operations (v3beta1)

Some methods of the Cloud Translation API return a long-running operation. These methods are asynchronous, and the operation may not be completed when the method returns a response. You can check on the status of an operation, or cancel an operation.

Operation status

The following shows how to poll an operation's status.

REST & CMD LINE

Call the get method for the operation resource.

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

  • project-id: your GCP project ID
  • location-id: the location you chose for your Cloud Storage bucket
  • operation-id: operation ID you received above

HTTP method and URL:

GET https://translation.googleapis.com/v3beta1/projects/project-id/locations/location-id/operations/operation-id

To send your request, expand one of these options:

You should receive a JSON response similar to the following:

{
  "name": "projects/project-id/locations/location-id/operations/operation-id",
  "metadata": {
    "@type": "placeholder",
    "state": "SUCCEEDED",
    "submitTime": "2019-02-27T22:59:40Z"
  }
}

When the operation has completed, a state value of SUCCEEDED is returned.

Operation cancelation

The following shows how to cancel an operation.

REST & CMD LINE

Call the cancel method on the operation resource.

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

  • project-id: your GCP project ID
  • location-id: the location you chose for your Cloud Storage bucket
  • operation-id: operation ID you received above

HTTP method and URL:

POST https://translation.googleapis.com/v3beta1/projects/project-id/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.

หน้านี้มีประโยชน์ไหม โปรดแสดงความคิดเห็น

ส่งความคิดเห็นเกี่ยวกับ...

หากต้องการความช่วยเหลือ ให้ไปที่หน้าการสนับสนุน