Complete State
| POST /services/${service_id}/states/${state_id}/end | |
Available since: 8.0.100.00 
 | 
Description
This operation terminates the state and updates its information with the body content.
Operation
| ID | CV.WS.SRV.6 | ||
|---|---|---|---|
| Method | POST | ||
| URL | /services/${service_id}/states/${state_id}/end | ||
| Field Name | Type | Mandatory | Description | 
| URI Parameters | |||
| ${service_id} | integer | yes | The unique 64-bit ID of the related service. | 
| ${state_id} | integer | yes | The 32-bit ID of the state to complete. | 
| Body: State End Event<ref>This body can contain fields from the State End Event resource.</ref> | |||
| session_id | string | no | The ID of the related session (for instance, the orchestration session or any other business session). Limited to 32 characters. | 
| interaction_id | string | no | The ID of the interaction at the service event's creation. Limited to 50 characters. | 
| application_type | long or string | no | The unique ID associated with the type or class<ref name="business">
 Refer to Configuration Options for more details on Business Attribute mapping.</ref> of application which issued the state event. May be used to group related applications, potentially across resource types.  | 
| application_id | integer | no | The Genesys DB ID for the application which issues the state event, such as a GVP VoiceXML application, Orchestration SCXML application, etc. | 
| resource_type | long or string | no | The unique ID associated with the type or class<ref name="business"/> of resource providing the related service (e.g. GVP, Agent Desktop, Orchestration). | 
| resource_id | integer | no | The unique DB ID for the specific resource which provides the related service. For instance:
  | 
| media_type | long or string | no | The media type<ref name="business"/> applicable to the given state, such as e-mail, voice, chat, etc. | 
| disposition | long or string | no | The unique ID for the business disposition<ref name="business"/> assigned to the given state. For instance, this can be the DB ID of a Business Attribute used to enumerate a given organization’s business dispositions. | 
| disposition_desc | string | no | The text description which provides additional context on the business disposition. Limited to 64 characters. | 
| timestamp | date/time | no | The UTC time at which the service event was raised, with a precision of milliseconds, using the ISO 8601<ref name="iso8601">See http://en.wikipedia.org/wiki/ISO_8601</ref> representation: [YYYY]-[MM]-[DD]T[HH]:[mm]:[ss].[SSS]Z. | 
| <extension name> | 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 | 200 | 
|---|---|
| HTTP message | OK | 
Example
Operation
The following sample completes a state and updates the associated single-valued extension "Feedback". It assumes that you are using integers for values.
 POST /services/6739/states/5362/end
 {
  "interaction_id":"00001a57JGQ00BVS",
  "disposition": 10,
  "disposition_desc": "SUCCESS",
   "application_type":400,
   "application_id":40,
   "resource_type":200,
   "resource_id":20,
   "media_type":2,
   "Feedback": 
    {
     "FeedbackType":"survey",
     "rating":7,
     "notes":"warm welcome at frontdesk, thanks for the nice trip"
    }
  } 
Result
200 OK
Operation
The following sample completes a state and updates the associated single-valued extension "Feedback". It assumes that you configured business values, which allow string values.
 POST /services/6739/states/5362/end
 {
   "interaction_id":"00001a57JGQ00BVS",
   "disposition": 10,
   "disposition_desc": "SUCCESS",
   "application_type":"customer_online_survey",
   "application_id":40,
   "resource_type":"html",
   "resource_id":20,
   "media_type":"webform",
   "Feedback": 
    {
     "FeedbackType":"survey",
     "rating":7,
     "notes":"warm welcome at frontdesk, thanks for the nice trip"
    }
  } 
Result
200 OK
Operation
The following sample completes a state and updates the associated single-valued extension "Feedback" and multi-valued extension "Satisfaction".
 POST /services/6739/states/5362/end
 {
  "interaction_id":"00001a57JGQ00BVS",
  "disposition": 10,
  "disposition_desc": "SUCCESS",
  "application_type":"customer_online_survey",
  "application_id":40,
  "resource_type":"html",
  "resource_id":20,
  "media_type":"webform",
  "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"
   }
   ]
 } 
Result
200 OK
