Perform State Transition
POST /services/${service_id}/states/transition | |
Available since: 8.0.100.00
|
Description
Performs a state transition for a given service. In many cases, your application is responsible for completing a given state and starting a new state, both in the context of a single interaction. In that context, your application can use this operation (instead of two separate Start State and Complete State operations) to reduce both the data duplication and the overall UCS services workload.
Operation
ID | CV.WS.SRV.7 | ||
---|---|---|---|
Method | POST | ||
URL | /services/${service_id}/states/transition | ||
Field Name | Type | Mandatory | Description |
URI Parameters | |||
service_id | integer | yes | The unique ID of the related service. |
Body: State Transition Event<ref>This body contains fieds from the State Transition Event.</ref> | |||
from | hash | yes | The hash of the following fields describing the state from which the service is transitioning:
Refer to Configuration Options for more details on Business Attribute mapping.</ref>.
|
to | hash | yes | The hash of the following fields, which describe the state into which the service is transitioning:
|
The following fields apply both to the state to complete and the state to start: | |||
session_id | string | no | The ID of the related session. For example, the orchestration session or any other business session. |
interaction_id | string | no | The ID of the related Genesys interaction. This ID can be used by other Genesys reporting products such as Stat Server, URS, Composer, and GVP. |
application_type | long or string | no | The unique ID associated with the type or class<ref name="business"/> of application issuing the service event. May be used to group related applications, potentially across resource types. |
application_id | integer | no | The unique ID (Genesys DB ID) for the application issuing the service event, such as a GVP VoiceXML application or an Orchestration SCXML application. |
resource_type | long or string | no | The unique ID associated with the type or class<ref name="business"/> of resource which provides the service (such as GVP, Agent Desktop, or Orchestration). |
resource_id | integer | no | The unique DB ID for the specific resource which provides the service. For instance:
|
media_type | long or string | no | The media type<ref name="business"/> applicable to the given state. For example: e-mail, voice, chat, etc. |
timestamp | date/time | no | The UTC time at which the event was raised, with a precision of milliseconds, using the ISO 8601<ref name="ISO 8601">http://en.wikipedia.org/wiki/ISO_8601</ref> representation : [YYYY]-[MM]-[DD]T[HH]:[mm]:[ss].[SSS]Z . If the application does not specify this timestamp, the server does it when the event is processed.
|
<extension name> Supported since 8.0.2
|
Extension (single-valued) or Extension[] (multi-valued) |
no | State extension. Your application can add as many state extensions as needed, as long as you created corresponding Extension Schema with the Create State Extension Schema operation. |
<references />
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 | 201 |
---|---|
HTTP message | Created |
Header | Location: /service/${service_id}/states/${state_id}
where:
|
Body | {"state_id": ${state_id}}
where: ${state_id} is the created state ID. |
Example
Operation
POST /services/735692/states/transition { "timestamp": "2009-05-07T12:05:20.157", "session_id": "11000ABC-80236C1A-1010", "interaction_id": "123ABC908ABFFD8080", "from": { "state_id": 1001, "disposition": 1, "disposition_desc": "SUCCESS", "Feedback": { "FeedbackType":"survey","rating":7, "notes":"warm welcome at frontdesk, thanks for the nice trip" }, "Satisfaction": [ { "rating":2, "pertinence":8, "usefull":true, "place":"Terranova mexico resort" }, { "rating":8, "pertinence":4, "usefull":false, "place":"Fancy resort Paris" } ] }, "to": { "state_type": 8, "est_duration": 500, "Sponsoring": { "Rank":"first","expire":7, "notes":"give customer free meal" } } }
POST /services/735692/states/transition { "timestamp": "2009-05-07T12:05:20.157", "session_id": "11000ABC-80236C1A-1010", "interaction_id": "123ABC908ABFFD8080", "from": { "state_id": 1001, "disposition": 1, "disposition_desc": "SUCCESS", "Feedback": { "FeedbackType":"survey","rating":7, "notes":"warm welcome at frontdesk, thanks for the nice trip" }, "Sponsoring": { "Rank":"first","expire":7, "notes":"give customer free meal" } }, "to": { "state_type": 8, "est_duration": 500, "Satisfaction": [ { "rating":7, "pertinence":3, "usefull":false, "place":"Australian beach resort complex" }, { "rating":9, "pertinence":8, "usefull":true, "place":"Caribbean beach complex" } ] } }
Result
201 Created {"state_id":15158}