Anywhere365 interface with SharePoint REST API

Introduction

SharePoint 2013 introduces a Representational State Transfer (REST) service, which can be exploited by Anywhere365. This technique makes it possible to interact remotely with your UCCUCC stands for Unified Contact Center and consists of a queue that can be handled by Agents Each Contact Center has its own settings, interactive voice response questions and Agent with specific skills. Agents can be member of, or sign up to, one or more Contact Centers. by using any technology that supports REST web requests in the Open Data Protocol (OData) structure. The default operations Create, Read, Update, and Delete (CRUD) can be used, from within your apps for SharePoint, solutions, and client applications, to manipulate the data in your UCC.

In the following examples, this interface is used to manage the Routing list. The Routing list makes it possible to route customers to the right queue instantly, based on their telephone number and/or SIPThe Session Initiation Protocol (SIP) is a protocol to make multimedia communication (audio, video and other data communication) possible and it is also used for Voice over IP (VoIP). SIP has similarities with other Internet protocols such as HTTP and SMTP. address, so there will be no necessity to go through the IVRInteractive Voice Response (IVR) is a telephone application to take orders via telephone keypad or voice through a computer. By choosing menu options the caller receives information, without the intervention of a human operator, or will be forwarded to the appropriate Agent..

 

Example 1: Request routing entries

As a simple start, let’s see how the existing entries from the routing list of a UCC can be retrieved. The web address that should be requested consists of three parts:

  1. SharePoint Server Name

  2. Path to Anywhere365 UCC Site

  3. Title of the list; in this example “Routing”

http://<SPServerName>/<PathUccSite>/_api/lists/getbytitle('<ListTitle>')/items

The request method for a read operation is “GET” and the default output is XML. In order to get the result in JSON format, include an Accept header, with the value “application/json;odata=verbose”

The following example shows you how to request a JSON representation of the routing list entries. It assumes that you have an OAuth access token stored in the accessToken variable.

GET http://<SPServerName>/<PathUccSite>/_api/lists/getbytitle('Routing')/itemsHTTP/1.1

Accept: application/json;odata=verbose

Authorization: Bearer <accessToken>

 

Example 2: Add routing entry

The next step is to add new Routing entries for new customers to the list. The web address for this operation is exactly the same as the web address that is used in the first example:

http://<SPServerName>/<PathUccSite>/_api/lists/getbytitle('Routing')/items

In order to add a new entry to the Routing list the Create operation should be used, this is the equivalent of the request method “POST”.

Also the headerContent-Type should be set to “application/json;odata=verbose” as well as the body of the. Furthermore, the “ListItemEntityTypeFullName” of the list should be posted. This name can be grasped from the result of a Read operation of the REST endpoint of the list itself:

http://<SPServerName>/<PathUccSite>/_api/lists/getbytitle('<ListTitle>')

By setting the variables in the body, you can choose whether the customer should be forwarded to a skill directly by setting the Skill Id or a message should be played first by setting the IVR Question Id.

The final result of the request to create a new entry in the Routing list is:

POST http://<SPServerName>/<PathUccSite>/_api/lists/getbytitle('Routing')/items HTTP/1.1

Accept: application/json;odata=verbose

Authorization: Bearer <accessToken>

Content-Type:application/json;odata=verbose

{

'_metadata':{'type': SP.Data.RoutingListItem},

'Title': '<title>',

'wsp_ucc_routing_match': '<LineURI / SIP address>',

'wsp_ucc_routing_order': '<order>',

'wsp_ucc_routing_skill': '<skill id>' OR

'wsp_ucc_routing_parentquestion': '<ivr question id>'

}

Note that either the Skill Id or the IVR Question Id should be set, not both.

If you want additional information about the variables that can be set for a Routing entry in Anywhere365 please go to: Core UCC Routing

 

Example 3: Update existing routing entry

When an existing Routing item should be updated, the web address that will be requested should point to a single list item. This can be realized by adding the Id of the List item in the web address:

http://<SPServerName>/<PathUccSite>/_api/lists/getbytitle('Routing')/items(<itemid>)

Also two additional headers should be added, stating that the request should update an existing item rather than creating a new one:

  1. IF-MATCH:*

  2. X-HTTP-Method:Merge

The complete request will be:

POST http://<SPServerName>/<PathUccSite>/_api/lists/getbytitle('Routing')/items (<item id>) HTTP/1.1

Accept: application/json;odata=verbose

Authorization: Bearer <accessToken>

IF-MATCH: *

X-HTTP-Method: MERGE

Content-Type:application/json;odata=verbose

{

'_metadata':{'type': SP.Data.RoutingListItem},

'Title': '<title>',

'wsp_ucc_routing_match': '<LineURI / SIP address>',

'wsp_ucc_routing_order': '<order>',

'wsp_ucc_routing_skill': '<skill id>' OR

'wsp_ucc_routing_parentquestion': '<ivr question id>'

}

Note that either the Skill Id or the IVR Question Id should be set, not both.

Also, the variables of the Routing entry are all optional, so you can define yourself which columns should be updated, and which columns should not be changed.

 

Example 4: Delete existing routing entry

Finally, if a routing entry is no longer required, it can be deleted. In this case the X-HTTP-Method should be changed from Merge to Delete and no Content-Type and body is required.

The following request, will delete the Routing entry with the item id that is declared in the web address:

POST http://<SPServerName>/<PathUccSite>/_api/lists/getbytitle('Routing')/items(<item id>) HTTP/1.1

Accept: application/json;odata=verbose

Authorization: Bearer <accessToken>

IF-MATCH: *

X-HTTP-Method: DELETE

 

For more information about the REST Service of Microsoft SharePoint please visit:

https://msdn.microsoft.com/en-us/library/office/fp142380.aspx