- *** Change the below to you API details on CXone Central ***
var implicitUri = "https://na1.nice-incontact.com";
var client_id = "csoneman@bsl.com";
var token_scope = "AdminApi AgentApi";
- *** Replace the XXXX with details of the new location of where this pages live hosting location ***
var redirect_uri = "XXXX";
var state_object = "myState";
function RedirectToAuthPage() {
var url = implicitUri;
url = url + "?state=" + state_object;
url = url + "&response_type=token";
url = url + "&client_id=" + encodeURIComponent(client_id);
url = url + "&redirect_uri=" + encodeURIComponent(redirect_uri);
//alert(url);
url = url + "&scope=" + encodeURIComponent(token_scope);
window.location.href = url;
}
function getParameterByName(param){
var vars = {};
window.location.href.replace( location.hash, '' ).replace(
/[?&]+([^=&]+)=?([^&]*)?/gi, // regexp
function( m, key, value ) { // callback
vars[key] = value !== undefined ? value : '';
}
);
if ( param ) {
return vars[param] ? vars[param] : null;
}
return vars;
}
function getAgents() {
var accessToken=decodeURIComponent(getParameterByName("access_token"));
var baseURI=decodeURIComponent(getParameterByName("resource_server_base_uri"));
getAgentsPayload = {
'updatedSince': '',
'isActive': 'true',
'searchString': '',
'fields': '',
'skip': '',
'top': '',
'orderBy': 'firstName'
}
$.ajax({
//The baseURI variable is created by the result.resource_server_base_uri,
//which is returned when getting a token and should be used to create the URL base
'url': baseURI + 'services/v12.1/agents',
'type': 'GET',
'headers': {
//Use access_token previously retrieved from inContact token service
'Authorization': 'bearer ' + accessToken,
'content-Type': 'application/x-www-form-urlencoded'
},
'data': getAgentsPayload,
'success': function (result, status, statusCode) {
//Process success actions
//alert("test="+result.agents[3].lastName);
//alert("test="+result.agents.length);
var select = document.getElementById ("nom");
for (i=0;i
CXone external controls