Query Service by ID
GET /services/${service_id} |
Description
Enables your application to query a service if its ID is known. By default, no tasks or states are returned. The example below shows how your application can use optional parameters to customize its request to specify which nested tasks and states of the service should be part of the response.
Operation
ID | CV.WS.SRV.14 | ||
---|---|---|---|
Method | GET | ||
URL | /genesys/1/cs/services/${service_id} | ||
Field Name | Type | Mandatory | Description |
URI Parameters | |||
${service_id} | integer | yes | The service ID. |
active_states | bool | no |
|
completed_states | bool | no |
|
active_tasks | bool | no |
|
completed_tasks | bool | no |
|
extensions | string | no |
List of extension names separated with commas, which will be returned with the service. For example: such as
http://localhost:8010/genesys/1/cs/services/383-f9a62aec-e6f2-45cb-aa01-0d9404f905bd?active_states=true&completed_states=true&extensions=Feedback,satisfaction You can also prefix the extension name with the a "State" or "Task" entity name followed by dot and extension name. For example: http://localhost:8010/genesys/1/cs/services/383-f9a62aec-e6f2-45cb-aa01-0d9404f905bd?active_states=true&completed_states=true&extensions=State.Feedback,State.satisfaction Alternatively, all extensions can be returned with specifying extensions=*, or simply entity extensions with specifying for example extensions=State. |
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.
HTTP code | 200 | ||
---|---|---|---|
HTTP message | OK | ||
Field Name | Type | Mandatory | Description |
Body: Service. This response includes the representation of the Service associated with the service ID. | |||
service_type | long or string | yes | The unique ID associated with the service type, typically the DB ID of a value in the Service Type Business Attribute. Refer to Configuration Options for more details about Business Attribute mapping. |
service_id | integer | yes | The service's unique ID. Only top-level objects include this field. For instance, if your application retrieves a service which includes nested states and tasks, only the top-level service object contains this ID. |
started | Service Start Event | yes | Start event (see Start Service). This event does not include the "est_duration" field, if "est_duration" is specified at the service level of the response. |
completed | Service End Event | no | The related end event if the service is completed (see Complete Service). This event does not include the "disposition" and "disposition_desc" fields if they are specified at the service level of the response. |
customer_id | string | no | The customer's unique ID. If the service has no customer ID, the service is Anonymous Service. Only top-level objects include this field. For instance, if your application retrieves a service which includes nested states and tasks, only the top-level service object contains this ID. |
est_duration | integer | no | The estimated time for completing the service, in seconds. |
duration | integer | no | The total duration in milliseconds. Important Only relevant for completed services. |
disposition | integer | no | ID of the Business disposition ID. Important Only relevant for completed services. |
disposition_desc | string | no | The reason for assigning the business disposition with the service element. Limited to 256 characters. |
active_states | State[] | no | The array of the started states which are not completed. The field is returned if the corresponding option was set to true in the request. |
completed_states | State[] | no | The array of completed states through which the service has made transitions. The field is returned if the corresponding option was set to true in the request. |
active_tasks | Task[] | no | The array of the started tasks which are not completed. The field is returned if the corresponding option was set to true in the request. |
completed_tasks | Task[] | no | The array of the tasks which are completed as part of the service delivery. The field is returned if the corresponding option was set to true in the request. |
interactions | Interaction[] | no | The array of the interactions which are associated with this service. The field is returned if the corresponding option was set to true in the request. |
<extension key> | Any JSON type | no | Service attached data as key-value pairs. You can add as many key-value pairs as needed. |
Example
Operation The following operation retrieves the given service (ID=2000) with its active states and tasks to resume the activity.
GET http://localhost:8080/genesys/1/cs/services/3005?active_states=true&completed_states=true&active_tasks=true&completed_tasks=true&extensions=ClientInfo,relatedOffers
Result
{
"completed_tasks" : [ {
"service_id" : 3005,
"duration" : 82937,
"disposition_desc" : "normal ending",
"task_id" : 2001,
"task_type" : 55,
"est_duration" : 540,
"started" : {
"timestamp" : "2010-06-03T08:49:53.053Z",
"interaction_id" : "587"
},
"disposition" : 5,
"completed" : {
"timestamp" : "2010-06-03T08:51:15.990Z",
"interaction_id" : "587"
}
} ],
"service_id" : 3005,
"active_states" : [ {
"service_id" : 3005,
"state_id" : 4000,
"state_type" : 100,
"est_duration" : 60,
"started" : {
"timestamp" : "2010-06-03T08:48:18.257Z",
"application_type" : 400,
"resource_id" : 20,
"media_type" : 2,
"resource_type" : 200,
"application_id" : 40,
"interaction_id" : "51"
}
} ],
"ClientInfo" : {
"userAgent" : "Mozilla/5.0 (Windows; U; Windows NT 5.1; fr; rv:1.9.2) Gecko/20100115 Firefox/3.6 (.NET CLR 3.5.30729)",
"clientIp" : "192.168.1.1",
"contentType" : "Content-Type : application/json;charset=UTF-8"
},
"active_tasks" : [ {
"service_id" : 3005,
"state_id" : 4001,
"task_id" : 2000,
"task_type" : 55,
"est_duration" : 540,
"started" : {
"timestamp" : "2010-06-03T08:49:45.943Z",
"interaction_id" : "587"
}
} ],
"service_type" : 100,
"est_duration" : 300,
"started" : {
"timestamp" : "2010-09-07T07:58:16.313Z",
"application_type" : 400,
"resource_id" : 10,
"media_type" : 2,
"resource_type" : 200,
"application_id" : 40,
"interaction_id" : "56"
},
"completed_states" : [ {
"service_id" : 3005,
"state_id" : 4001,
"duration" : 182907,
"disposition_desc" : "normal ending",
"state_type" : 200,
"est_duration" : 300,
"started" : {
"timestamp" : "2010-06-03T08:48:51.473Z",
"application_type" : 400,
"resource_id" : 6000,
"media_type" : 3,
"resource_type" : 100,
"application_id" : 40,
"interaction_id" : "8001"
},
"disposition" : 5,
"completed" : {
"timestamp" : "2010-06-03T08:51:54.380Z",
"interaction_id" : "1587"
}
} ],
"relatedOffers" : [ {
"offer_name" : "VIP credit card black ed.",
"type" : "9",
"comments" : "proposed to all client"
}, {
"offer_name" : "3 times payment GOLD",
"type" : "4",
"comments" : "limited offer"
}, {
"offer_name" : "life insurance",
"type" : "3",
"comments" : "healt check to be done before approval"
} ],
"contact_key" : "bob"
}
Additional comments:
- The service=2000 does not contain completed values. It is an active service.
- There was no active states for this service.
- There is a single active task.