Contents
Service API
Overview
This API is used by customer facing applications to manage different type of contact center related services (for example the app-to-connect-basic service provides the necessary contact center access information so the end user and associated application can initiate an interaction with the contact center).
API
Create
This API creates and initiates a service. It will support the creation and initiation of an service that is configured in Genesys Mobile Services. For details on the supported set of services, see the Overview of Services.
Operation
Method | POST | ||
---|---|---|---|
URL | /genesys/1/service/{service} | ||
Parameter | Type | Mandatory | Description |
URI Parameters | |||
{service} | string | yes | The name of the service that is to be created and initiated. |
Body: The body can be either a MultiPart form or x-www-form-urlencoded form consisting of different items representing the key/value pairs associated with the given service type. In the case of MultiPart, the values can be strings or files but with urlencoded the values can only strings. |
Response
HTTP code | 200 |
---|---|
HTTP message | OK |
Body |
A JSON object with the following: {"id": ${service_id}, {service_specific_data'}'}
where:
|
If a matching services does not find a match, it will return the following status code.
HTTP code | 404 |
---|---|
HTTP message | Not Found |
Example
The following example starts a request-interaction service:
- with the end user's phone number and application data: current user's location, preferred language, and end user's picture.
Operation
Request URL:http://localhost:8080/genesys/1/service/request-interaction Request Method:POST Status Code:200 OK Request Headersview source Accept:*/* Accept-Charset:ISO-8859-1,utf-8;q=0.7,*;q=0.3 Accept-Encoding:gzip,deflate,sdch Accept-Language:en-US,en;q=0.8 Connection:keep-alive Content-Length:13028 Content-Type:multipart/form-data; boundary=----WebKitFormBoundaryy16qocbN6tmPORZL Host:localhost:8080 Origin:http://localhost:8080 Referer:http://localhost:8080/GMS-web/resources/servicetest.html User-Agent:Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.7 (KHTML, like Gecko) Chrome/16.0.912.77 Safari/535.7 Request Payload ------WebKitFormBoundaryy16qocbN6tmPORZL Content-Disposition: form-data; name="_phone_number" 6504669999 ------WebKitFormBoundaryy16qocbN6tmPORZL Content-Disposition: form-data; name="_provide_code" true ------WebKitFormBoundaryy16qocbN6tmPORZL Content-Disposition: form-data; name="language" french ------WebKitFormBoundaryy16qocbN6tmPORZL Content-Disposition: form-data; name="current_location_latitude" 48.8583 ------WebKitFormBoundaryy16qocbN6tmPORZL Content-Disposition: form-data; name="current_location_longitude" 2.2944 ------WebKitFormBoundaryy16qocbN6tmPORZL Content-Disposition: form-data; name="FileKey"; filename="MyPic.png" Content-Type: image/png ------WebKitFormBoundaryy16qocbN6tmPORZL--
Result
The above service will be started with an id of 39a98e24-b03b-4191-b756-1efe8f3b16b8.
HTTP 200 OK { "_id":"39a98e24-b03b-4191-b756-1efe8f3b16b8","_access_number":"8003449999", _access_code="7684" }
Service specific Request
This API allows the application to perform a specific request against given service. For details on the specific requests that can be performed for a given type of service, see the Overview of Services.
Important Note: only to be used for request-inbound-...
or request-outbound-...
based services otherwise it will be rejected.
Operation
Method | POST | ||
---|---|---|---|
URL | /genesys/1/service/{service_id}/{request} | ||
Parameter | Type | Mandatory | Description |
URI Parameters | |||
{service_id} | string | yes | The id of the service that is to be deleted. |
{request} | string |
yes |
This is the name of the request that is to be performed. |
Body: The body can be either a MultiPart form or x-www-form-urlencoded form consisting of different items representing the key/value pairs associated with the given service request. In the case of MultiPart, the values can be strings or files but with urlencoded the values can only strings. |
Response
HTTP code | 200 |
---|---|
HTTP message | OK |
Body |
This will contain the appropriate output data (JSON data) that is defined by the given service request definition. |
Example
The following example requests status of a request-inbound-poll
service:
Operation
Request URL:http://localhost:8080/GMS-web/gms/1/service/39a98e24-b03b-4191-b756-1efe8f3b16b8/status Request Method:POST Status Code:200 OK Request Headersview source Accept:*/* Accept-Charset:ISO-8859-1,utf-8;q=0.7,*;q=0.3 Accept-Encoding:gzip,deflate,sdch Accept-Language:en-US,en;q=0.8 Connection:keep-alive Host:localhost:8080 Origin:http://localhost:8080 Referer:http://localhost:8080/GMS-web/resources/servicetest.html User-Agent:Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.7 (KHTML, like Gecko) Chrome/16.0.912.77 Safari/535.7 Request Payload
Result The status for service 39a98e24-b03b-4191-b756-1efe8f3b16b8 has been retreived.
HTTP 200 OK { "status":"waiting-for-agent", "dialog":"/waitingforagent.html" }
Notes
Parameters that begin with an underscore (_) are passed to ORS. Anything else is considered user data, and is saved in storage. The stored data can be retrieved using _data_id parameter passed in scxml.