CPC RI

window.CPC.RI allows to easily access Contact Pro Restful Interfaces, such as the RMI, in current user context.

Methods

(async) request(api, method, resource, bodyopt) → {object}

Call Restful Interfaces easily, in context of current user.
Parameters:
NameTypeAttributesDescription
api'RCI' | 'CMI' | 'DPI' | 'OBI' | 'RTI' | 'RAI' | 'LRI' | 'RMI'The destination API
method'GET' | 'POST' | 'PUT' | 'DELETE'HTTP verb
resourcestringFor example '/users' of the RCI API.
bodyobject<optional>
Request body (for POST and PUT)
Returns:
When successful, function returns the JSON returned by the API. When failed, an object describing failure is returned.
Type: 
object

(async) setPresence(sProfile) → {object}

Uses request to call RMI PUT /agents/{agentId}/presences/{presenceId} to set user's presence profile.
Parameters:
NameTypeDescription
sProfilestringProfile id or name.
Tip: Check current user's presence_profiles from CPC.currentUser.
Returns:
Result of profile change. Note: Client code event handler is fired with same value.
Type: 
object

(async) setReady(bReady) → {object}

Uses request to call RMI PUT /agents/{agentId}/readyState to set user's Ready-state.
Parameters:
NameTypeDescription
bReadybooleanTrue=Ready, False=NotReady.
Returns:
Result of ready-state change. Client code event handler is fired with same value.
Type: 
object