window.CPC.RI allows to easily access Contact Pro Restful Interfaces, such as the RMI, in current user context.
- Source
Methods
(async) request(api, method, resource, bodyopt) → {object}
Call Restful Interfaces easily, in context of current user.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
api | 'RCI' | | The destination API | |
method | 'GET' | | HTTP verb | |
resource | string | For example '/users' of the RCI API. | |
body | object | <optional> | Request body (for POST and PUT) |
- Source
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:
Name | Type | Description |
---|---|---|
sProfile | string | Profile id or name. Tip: Check current user's presence_profiles from CPC.currentUser. |
- Source
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:
Name | Type | Description |
---|---|---|
bReady | boolean | True=Ready, False=NotReady. |
- Source
Returns:
Result of ready-state change. Client code event handler is fired with same value.
- Type:
- object