Long-running operations

Some methods of the Dialogflow 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 or cancel operations.

Get an operation status

The following shows how to poll an operation's status. If you have many operations to check, you should rate limit your calls or use the list method instead.

REST & CMD LINE

Call the get method for the Operations resource.

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

  • REGION_ID: your region ID
  • PROJECT_ID: your GCP project ID
  • OPERATION_ID: your operation ID

HTTP method and URL:

GET https://REGION_ID-dialogflow.googleapis.com/v3/projects/PROJECT_ID/locations/REGION_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/REGION_ID/operations/OPERATION_ID",
  "metadata": {
    "@type": "type.googleapis.com/google.cloud.dialogflow.v3.SomeOperationType",
    "state": "DONE"
  },
  "done": true,
  ...
}

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