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 of an operation.
Get an operation status
The following shows how to poll an operation's status.
REST & CMD LINE
Call the get
method for the
Operations
type.
Before using any of the request data below, make the following replacements:
- project-id: your GCP project ID
- operation-id: your operation ID
- api-version: either
v2
orv2beta1
HTTP method and URL:
GET https://dialogflow.googleapis.com/api-version/projects/my-gcp-project/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/operations/some-operation-name-operation-id", "metadata": { "@type": "type.googleapis.com/google.cloud.dialogflow.api-version.SomeOperationType", "state": "DONE" }, "done": true, ... }
When the operation has completed,
a state
value of SUCCESSFUL
is returned.