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 | /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 Supported since 8.0.2
|
string | no | Extension name to retrieve with the results. Your application can specify several names separated by commas, as long as you created corresponding Extension Schema with the Create Service Extension Schema operation. For example: extensions=Feedback,SpecialOffer. |
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<ref>This response includes the representation of the Service associated with the service ID.</ref> | |||
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.<ref name="toplevel">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.</ref> |
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<ref name="toplevel"/>. If the service has no customer ID, the service is Anonymous Service. |
est_duration | integer | no | The estimated time for completing the service, in seconds. |
duration | integer | no | The total duration in milliseconds. Only relevant for completed services.
|
disposition | integer | no | ID of the Business disposition ID. 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<ref name="option">The field is returned if the corresponding option was set to true in the request.</ref> | The array of the started states which are not completed. |
completed_states | State[] | no<ref name="option"/> | The array of completed states through which the service has made transitions. |
active_tasks | Task[] | no<ref name="option"/> | The array of the started tasks which are not completed. |
completed_tasks | Task[] | no<ref name="option"/> | The array of the tasks which are completed as part of the service delivery. |
interactions | Interaction[] | no<ref name="option"/> | The array of the interactions which are associated with this service. |
<extension name> Supported since 8.0.2
|
Extension (single-valued) or Extension[] (multi-valued) |
no | Service extension matching the parameter passed in the operation. |
<references />
Example
Operation The following operation retrieves the given service (ID=2000) with its active states and tasks to resume the activity.
GET /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" }
- 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.