Jump to: navigation, search

Query States

ApiRef2.png GET /services/${service_id}/states
Available since: 8.0.100.00

Description

This operation queries the states for a given service. By default, all the states are returned, but your application can filter the results to retrieve only active or completed states, based on the specified URI. Additional URI parameters enable to include task information in the response.

Operation

Query states
ID CV.WS.SRV.12
Method GET
URL
  1. All (default): /services/${service_id}/states
  2. Active States: /services/${service_id}/states/active
  3. Completed States: /services/${service_id}/states/completed
Field Name   Type   Mandatory Description
URI Parameters
${service_id} string yes The service ID generated from the Start Service operation.
state_types integer no Filters specific service state types. The possible enumerated values are available in the filter field of the State resources. You can specify several state_type values separated by commas.
active_tasks bool no
  • true to include information the service's active tasks in the results.
  • false (default)
completed_tasks bool no
  • true to include information on the service's completed tasks in the results.
  • false (default)
extensions
Supported since 8.0.2
string no Names separated by commas of the state extensions to return with the matching state resources. By default, no extensions are returned.

Response

The Context Management Service API answers with HTTP codes for every request. The following table shows the correct response for a successful request. See HTTP Response Codes and Errors for further details on the possible codes that this operation can return.

Response
HTTP code 200
HTTP message OK
Body State[]

Example

Operation

 GET /services/ABC1235XZY/states/active&active_tasks=true&completed_tasks=true&extensions=Feedback

Result The following output shows a possible response for the previous request:

 200 OK
 [ // array of one or more state object
   {
     "service_id" : 1,
     "state_id" : 0,
     "state_type" : 100,
     "est_duration" : 60,
     "started" : {
     "timestamp" : "2010-05-18T15:23:34.447Z",
     "application_type" : 400,
     "resource_id" : 20,
     "media_type" : 2,
     "resource_type" : 200,
     "application_id" : 40,
     "interaction_id" : "51" 
     "Feedback": 
      { "FeedbackType":"survey",
        "rating":7,
        "notes":"warm welcome at frontdesk, thanks for the nice trip"}
      },
 
     "active_tasks": [
      // included given specification of "results" attribute
      { // array of one or more Task objects
        "task_id": 25080,
        "task_type": 5, // application-defined task type
        "est_duration": 300,
        "started": {
        "timestamp": "2009-05-07T12:08:53.298",
       }
      }
     ]
     "completed_tasks": [
      { "task_id": 24027,
        "task_type": 2, // e.g. task for processing quote
        "disposition": 10, // e.g. quote completed
        "disposition_desc": "<text describing quote result>",
        "started": {
          "timestamp": "2009-05-07T12:02:23.715",
          "interaction_id": "123ABC908ABFFD8080"
         },
        "completed": {
          "timestamp": "2009-05-07T12:06:23.715",
          "interaction_id": "157C9A208AFD523D01"
        }
      }
     ]
  },
  {
    "service_id" : 1,
    "state_id" : 1,
    "state_type" : 100,
    "est_duration" : 60,
    "started" : {
    "timestamp" : "2010-05-18T15:23:41.977Z",
    "application_type" : 400,
     "resource_id" : 20,
     "media_type" : 2,
     "resource_type" : 200,
    "application_id" : 40,
    "interaction_id" : "51"
   }
 }
 ]
This page was last edited on November 23, 2017, at 16:00.
Comments or questions about this documentation? Contact us for support!