Some methods return a long-running operation. Long-running methods are asynchronous, and the operation might not be completed when the method returns a response. You can poll the operation to check on its status.
Get an operation status
The following shows how to poll an operation's status by calling the get
method on the
Operation
resource.
REST
Refer to the operations:get
API endpoint for complete details. When the operation has completed,
a state
value of SUCCESSFUL
is returned. The following example demonstrates
the expected JSON output when a CreateIssueModel
operation has completed.
Your output might vary depending on which API produced the operation.
Before using any of the request data, make the following replacements:
- PROJECT_ID: your Google Cloud project ID.
- OPERATION_ID: the ID of the conversation you want to analyze. This value was returned when you created the analysis.
HTTP method and URL:
GET https://contactcenterinsights.googleapis.com/v1/projects/PROJECT_ID/locations/us-central1/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/us-central1/operations/OPERATION_ID", "metadata": { "@type": "type.googleapis.com/google.cloud.contactcenterinsights.v1.CreateIssueModelMetadata", "createTime": "2021-01-20T10:10:10.123000Z", "endTime": "2021-01-20T11:11:11.456000Z", "request": { "parent": "projects/PROJECT_ID/locations/us-central1", "issueModel": { "displayName": "MODEL_NAME", "inputDataConfig": { "medium": "CHAT", "trainingConversationsCount": "12000", "filter": "medium=\"CHAT\"" } } } }, "done": true, "response": { "@type": "type.googleapis.com/google.cloud.contactcenterinsights.v1.IssueModel", "name": "projects/PROJECT_ID/locations/us-central1/issueModels/ISSUE_MODEL_ID", "displayName": "my-model", "createTime": "2021-01-20T11:11:11.456000Z", "state": "UNDEPLOYED", "inputDataConfig": { "medium": "CHAT", "trainingConversationsCount": "12000", "filter": "medium=\"CHAT\"" }, "trainingStats": { "analyzedConversationsCount": "8000", "issueStats": { "projects/PROJECT_ID/locations/us-central1/issueModels/ISSUE_MODEL_ID/issues/123000": { "issue": "projects/$PROJECT/locations/us-central1/issueModels/ISSUE_MODEL_ID/issues/123000", "labeledConversationsCount": "10" }, "projects/PROJECT_ID/locations/us-central1/issueModels/ISSUE_MODEL_ID/issues/456000": { "issue": "projects/$PROJECT/locations/us-central1/issueModels/ISSUE_MODEL_IDL/issues/456000", "labeledConversationsCount": "20" }, ... } } } }
Python
To authenticate to Insights, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Java
To authenticate to Insights, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Node.js
To authenticate to Insights, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.