Base URL for all API calls is:
GET api/crm-integrations
Retrieves an existing CRM integration based on the query parameters.
Request
HTTP headers: Authorization: xelion <authorization_token>
Content-Type: */*
Query parameters: (com.xelion.cti.model.rest.RestGetCrmIntegrationBeanParams)
.../api/crm-integrations?xelionHost=myXelionHost&xelionTenant=myXelionTenanant
Response 200 OK
Content-Type: application/json
Response Body: (com.xelion.cti.model.rest.RestCrmIntegration)
{
"crmContext":
{
"authorizationHeaderPrefix": "string",
"authorizationServerUri": "https://example.org/services/oauth2/token",
"id": 0
},
"xelionContext":
{
"host": "www.xelionHost.com",
"id": 0,
"protocol": "https",
"tenant": "mytenant"
}
}
POST api/crm-integrations
Posts a new CRM integration. Please note that this operation performs an implicit login with the adminUsername/adminPassword combination passed in the payload. Therefore no Authorization Header is needed and if one is used it will be silently ignored.
The variables used in the placeholders in the "eventUriMappings" object must match fields used in the corresponding websocket messages. For a complete list of websocket messages and their fields, please have a look at link.
It is possible to use Unified Expression Language templates in the placeholders used in the crmResourceUri and crmResourcePayload fields. One of the most common use cases is the following:
${(initiation=="outgoing")?"calldialed":"callreceived"}
Please see the example request below for further details about how it is used in the JSON POST request message of the present resource. For further information about the Unified Expression Language specification please see the following link.
Request
Content-Type: application/json
Request Body: (com.xelion.cti.model.rest.RestCrmIntegration)
{
"xelionContext":
{
"adminUsername": "admin",
"adminPassword": "adminPassword",
"host": "www.xelionHost.com",
"tenant": "tenantToBeUsed",
"protocol": "http"
},
"crmContext":
{
"authorizationServerUri": "https://example.org/services/oauth2/token",
"authorizationHeaderPrefix": "Bearer "
},
"userCredentials":
[
{
"xelionUsername": "xelionUsername",
"clientId": "xxxxxxx",
"clientSecret": "yyyyyyyy",
"deviceCode": "zzzzzzzz",
"refreshToken": "aaaaaaaa"
}
],
"eventUriMappings":
[
{
"xelionEvent": "newCallEvent",
"crmResourceUri": "https://example.org/services/apexrest/Call",
"crmResourcePayload":
{
"initiation" : "${(initiation==\"outgoing\")?\"calldialed\":\"callreceived\"}",
"to" : "${calleePhoneNumber}",
"callId" : "${callId}",
"eventType" : "newCallEvent"
}
},
{
"xelionEvent": "callConnectedEvent",
"crmResourceUri": "https://example.org/services/apexrest/Call",
"crmResourcePayload":
{
"initiation" : "${(initiation==\"outgoing\")?\"calldialed\":\"callreceived\"}",
"to" : "${calleePhoneNumber}",
"callId" : "${callId}",
"eventType" : "callConnectedEvent"
}
},
{
"xelionEvent": "callHungUpEvent",
"crmResourceUri": "https://example.org/services/apexrest/Call?initiation=${(initiation=="outgoing")?"calldialed":"callreceived"}",
"crmResourcePayload":
{
"to" : "${calleePhoneNumber}",
"callId" : "${callId}",
"eventType" : "callHungUpEvent"
}
},
{
"xelionEvent": "missedCallEvent",
"crmResourceUri": "https://example.org/services/apexrest/Call",
"crmResourcePayload":
{
"initiation" : "${(initiation==\"outgoing\")?\"calldialed\":\"callreceived\"}",
"to" : "${calleePhoneNumber}",
"callId" : "${callId}",
"eventType" : "missedCallEvent"
}
}
]
}
Response 200 OK
Content-Type: application/json
Response Body: (com.xelion.cti.model.rest.RestCrmIntegration)
{
"crmContext":
{
"authorizationHeaderPrefix": "string",
"authorizationServerUri": "https://example.org/services/oauth2/token",
"id": 0
},
"xelionContext": {
"host": "example.org",
"id": 0,
"protocol": "https",
"tenant": "myXelionTenant"
}
}
DELETE api/crm-integrations/{xelionContextId}
Deletes a crm-integration, which is all the information belonging to a specific xelionContext, from the database.
Request
HTTP headers: Authorization: xelion <authorization_token>
Content-Type: */*
Path parameters: (com.xelion.cti.model.rest.RestXelionContextIdParam)
.../api/crm-integrations/121
GET api/crm-integrations/{xelionContextId}/crm-contexts/{crmContextId}/user-credentials
Retrieves information about users. If one or both query parameters are specified exactly one user is returned in the response array.
Request without query parameters
HTTP headers: Authorization: xelion <authorization_token>
Content-Type: */*
Path parameters: (com.xelion.cti.model.rest.RestContextIdParams)
.../api/crm-integrations/121/crm-contexts/121/user-credentials
Response 200 OK
Content-Type: application/json
Response Body: (com.xelion.cti.model.rest.response.RestUserCredentialsResponse)
[
{
"xelionUsername": "myXelionUsername",
"xelionOid": "111222333",
"userCredentialsId": "5"
},
{
"xelionUsername": "myXelionUsername1",
"xelionOid": "3334445555",
"userCredentialsId": "6"
}
]
Request with username query parameter
HTTP headers: Authorization: xelion <authorization_token>
Content-Type: */*
Path parameters: (com.xelion.cti.model.rest.RestContextIdParams)
Query parameters: (username, oid)
.../api/crm-integrations/121/crm-contexts/121/user-credentials?username=myXelionUsername
Response 200 OK
Content-Type: application/json
Response Body: (com.xelion.cti.model.rest.response.RestUserCredentialsResponse)
[
{
"xelionUsername": "myXelionUsername",
"xelionOid": "111222333",
"userCredentialsId": "5"
}
]
Request with xelion oid query parameter
HTTP headers: Authorization: xelion <authorization_token>
Content-Type: */*
Path parameters: (com.xelion.cti.model.rest.RestContextIdParams)
Query parameters: (username, oid)
.../api/crm-integrations/121/crm-contexts/121/user-credentials?oid=3334445555
Response 200 OK
Content-Type: application/json
Response Body: (com.xelion.cti.model.rest.response.RestUserCredentialsResponse)
[
{
"xelionUsername": "myXelionUsername1",
"xelionOid": "3334445555",
"userCredentialsId": "6"
}
]
POST api/crm-integrations/{xelionContextId}/crm-contexts/{crmContextId}/user-credentials
Inserts a new Xelion user in the CTI database. Both the xelionContextId and crmContextId must exist in the CTI database. If not a 404 error is returned. It is possible to retrieve those with the GET /crm-integrations resource. Also, the user must exist in the Xelion system database, otherwise a 500 error is returned.
Request
HTTP headers: Authorization: xelion <authorization_token>
Content-Type: application/json
Path parameters: (com.xelion.cti.model.rest.RestContextIdParams)
Request Body: (com.xelion.cti.model.rest.request.RestUserRequest)
[
{
"xelionUsername": "xelionUsername",
"clientId": "xxxxxxxxxxxx",
"clientSecret": "yyyyyyyyyyyyy",
"deviceCode": "zzzzzzzzzzzzzzzzz",
"refreshToken": "aaaaaaaaaaaaaaaa"
}
]
Response 200 OK
Content-Type: application/json
Response Body: (com.xelion.cti.model.rest.response.RestUserCredentialsResponse)
{
"xelionUsername": "xelionUsername",
"xelionOid": "111222333",
"userCredentialsId": "5"
}
POST api/cti-app-context
Posts a new Xelion client app - external service integration, which needs OAuth 2.0 authentication. To call this resource an Authorization HTTP header containing "xelion" as prefix followed by space and a valid xelion token must be present. This resource makes it possible for a Xelion app user to integrate his Xelion data with the data present on the external service. Please notice that if the Authorization header requires a space between header prefix and access token, this should be explicitly inserted in the "authorizationHeaderPrefix" field value. Client secret parameter is optional.
Request
Content-Type: application/json
Authorization: xelion <xelion_token>
Request Body: (com.xelion.cti.model.rest.request.RestCtiAppRequest)
{
"appExternalApiContext": {
"authorizationServerUri": "https://externalServiceAuthHost.com/oauth2/v2.0/token",
"authorizationHeaderPrefix": "myAuthorizationHeaderPrefix " //space here needs to be explicitly set, if expected when putting it into the authorization header.
},
"appUserContext": {
"clientId": "myClientId",
"xelionUsername": "myXelionUsername",
"clientSecret": "myClientSecret",
"refreshToken": "myRefreshToken",
"accessToken": "myAccessToken"
},
"appXelionContext": {
"host": "developer.xelion.nl",
"tenant": "master"
}
}
Response
Content-Type: */*
200 OK
POST api/external-api-endpoint/call
Calls an external service API endpoint which needs OAuth 2.0 authentication. To call this resource an Authorization HTTP header containing "xelion_cti" as prefix followed by space and an access token from the external service must be present. This resource is useful for example to retrieve data present on that external service (e.g. Microsoft Exchange). The HTTP status of the external call will be returned as HTTP status code of this response. If present query parameters in endpointUri need to be URL encoded. The "authorizationServerUri" field needs to have the same exact value as the one that was used in the corresponding POST api/cti-app-context call.
Request
Content-Type: application/json
Authorization: xelion_cti <external_service_access_token>
Request Body: (com.xelion.cti.model.rest.request.RestExternalApiEndpointRequest)
{
"appXelionContext": {
"host": "xelionHost.com",
"tenant": "myTenant"
},
"endpointContext": {
"authorizationServerUri": "https://externalServiceAuthHost.com/oauth2/v2.0/token",
"endpointUri": "https://externalServiceEndpointHost.com/endpoint?encodedQueryParam1=encodedQueryParamValue1",
"payload": {
"requestPayloadField1": "requestPayloadValue1",
...
...
...
},
"method": "POST"
},
"xelionUsername": "myXelionUsername"
}
Response
Content-Type: application/json
200 OK - call to external service finished ok
Response Body: (com.xelion.cti.model.rest.response.RestExternalApiEndpointResponse)
{
"accessToken": "Updated-XXXXXXXYYYYYY",
"payload": {
"payloadFromExternalServiceField1": "payloadFromExternalServiceValue1"
...
...
...
}
}
Response
Content-Type: application/json
400 OK - bad request response from external service
Response Body: (com.xelion.cti.model.rest.response.RestExternalApiEndpointResponse)
As received from external service.
{
"payloadFromExternalServiceField1": "payloadFromExternalServiceValue1",
...
...
...
}
POST api/session/login
Authenticates in the CTI service and returns an API token which can be used in subsequent Resource requests, which need an Authorization HTTP header. Please note that in subsequent request the API token needs to be prefixed with “xelion ”, e.g. “xelion xxxyyyyyxxxyy”
Request
Content-Type: application/json
Request Body: (com.xelion.cti.model.rest.RestCrmIntegration)
{
"adminUsername": "myUserName",
"adminPassword": "xxxxxxxxx",
"host": "host.test.com",
"tenant": "myTenant"
}
Response 200 OK
Content-Type: application/json
Response Body: (com.xelion.cti.model.rest.RestCrmIntegration)
{
"authentication": "xxxxxxxyyyyyyyyyyyyyyzzzzzzzzzz",
"validUntil": "2018-12-14 09:48:45"
}
GET api/users/{userId}
Retrieves a single user and returns non security sensitive information.
Request
HTTP headers: Authorization: xelion <authorization_token>
Content-Type: */*
Path parameters: (com.xelion.cti.model.rest.RestUserIdParam)
.../api/users/3
Response 200 OK
Content-Type: application/json
Response Body: (com.xelion.cti.model.rest.response.RestUserResponse)
{
"xelionOid": "myXelionUsername",
"xelionUsername": "111222333"
}
PUT api/users/{userId}
Allows to update information got by the corresponding GET request.
Request
HTTP headers: Authorization: xelion <authorization_token>
Content-Type: application/json
Path parameters: (com.xelion.cti.model.rest.RestUserIdParam)
Request Body: (com.xelion.cti.model.rest.request.RestXelionUserRequest)
.../api/users/3
{
"xelionUsername": "myNewXelionUsername",
"xelionOid": "333444555"
}
Response 200 OK
Content-Type: application/json
DELETE api/users/{userId}
Allows to delete a single user.
Request
HTTP headers: Authorization
Content-Type: */*
Path parameters: (com.xelion.cti.model.rest.RestUserIdParam)
.../api/users/3
Response 200 OK
Content-Type: application/json
POST api/users/{userId}/{oauthCredentialsType}/update
Updates the OAuth 2.0 credentials of a user. The "oauthCredentialsType" path parameter can be one of clientid, clientsecret, refreshtoken, devicecode.
Request
HTTP headers: Authorization: xelion <authorization_token>
Content-Type: application/json
Path parameters: (com.xelion.cti.model.rest.RestUserIdParam, com.xelion.cti.model.rest.RestOAuthTokenType)
Request Body: (com.xelion.cti.model.rest.request.RestUpdateValueRequest)
.../api/users/3/clientid/update
.../api/users/3/clientsecret/update
.../api/users/3/refreshtoken/update
.../api/users/3/devicecode/update
{
"value": "newValue"
}
Response 200 OK
Content-Type: */*
GET api/xelion-environment/{xelionContextId}
Gets information about the xelion environment.
Request.
HTTP headers: Authorization: xelion <authorization_token>
Content-Type: */*
Path parameters: (com.xelion.cti.model.rest.RestXelionContextIdParam)
.../api/xelion-environment/161
Response 200 OK
Content-Type: application/json
Response Body: (com.xelion.cti.model.rest.RestXelionEnvironment)
{
"host": "www.myxelionhost.com",
"protocol": "https",
"tenant": "myxeliontenant"
}
PUT api/xelion-environment/{xelionContextId}
Updates information about the xelion environment.
Request
HTTP headers: Authorization: xelion <authorization_token>
Content-Type: application/json
Path parameters: (com.xelion.cti.model.rest.RestXelionContextIdParam)
Request Body: (com.xelion.cti.model.rest.RestXelionEnvironment)
.../api/xelion-environment/161
{
"host": "www.mynewxelionhost.com",
"tenant": "mynewxeliontenant",
"protocol": "https"
}
Response 200 OK
Content-Type: */*
POST api/xelion-environment/{xelionContextId}/admin/password/update
Updates the xelion admin username.
Request
HTTP headers: Authorization: xelion <authorization_token>
Content-Type: application/json
Path parameters: (com.xelion.cti.model.rest.RestXelionContextIdParam)
Request Body: (com.xelion.cti.model.rest.request.RestUpdateAdminUsernameRequest)
.../api/xelion-environment/161
{
"oldUsername": "oldAdminUsername",
"newUsername": "newAdminUsername"
}
Response 200 OK
Content-Type: */*
POST api/xelion-environment/{xelionContextId}/admin/username/update
Updates the xelion admin username.
Request
HTTP headers: Authorization: xelion <authorization_token>
Content-Type: application/json
Path parameters: (com.xelion.cti.model.rest.RestXelionContextIdParam)
Request Body: (com.xelion.cti.model.rest.request.RestUpdateAdminPasswordRequest)
{
"oldPassword": "oldAdminPassword",
"newPassword": "newAdminPasword"
}
Response 200 OK
Content-Type: */*
GET api/crm-integrations/{xelionContextId}/crm-contexts/{crmContextId}/event-uri-mappings
Retrieves the event uri mappings for a certain crm context.
Request without query parameters
HTTP headers: Authorization: xelion <authorization_token>
Content-Type: */*
Path parameters: (com.xelion.cti.model.rest.RestContextIdParams)
.../api/crm-integrations/121/crm-contexts/121/event-uri-mappings
Response 200 OK
Content-Type: application/json
Response Body: (com.xelion.cti.model.rest.response.RestEventUriMappingsResponse)
[
{
"xelionUsername": "myXelionUsername",
"xelionOid": "111222333",
"userCredentialsId": "5"
},
{
"xelionUsername": "myXelionUsername1",
"xelionOid": "3334445555",
"userCredentialsId": "6"
}
]
GET api/crm-integrations/{xelionContextId}/crm-contexts/{crmContextId}/event-uri-mappings
Retrieves the event uri mappings for a certain crm context.
Request
HTTP headers: Authorization: xelion <authorization_token>
Content-Type: */*
Path parameters: (com.xelion.cti.model.rest.RestContextIdParams)
.../api/crm-integrations/121/crm-contexts/121/event-uri-mappings
Response 200 OK
Content-Type: application/json
Response Body: array of (com.xelion.cti.model.rest.response.RestEventUriMappingsResponse)
[{
"createdAt": "2021-10-25T17:17:58.394532900",
"crmResourcePayload": {
"fromNumber": "${callerPhoneNumber}",
"callerUser": "${callerUser}",
"calleeUser": "${calleeUser}",
"myObject": {
"myPayload": "${callId}"
},
"calleeFlowId": "${calleeFlowId}",
"toNumber": "${calleePhoneNumber}",
"callerFlowId": "${callerFlowId}"
},
"crmResourceUri": "https://example.org/cti-server-stub/api/salesforce/services/data/v42.0/sobjects/Account",
"id": 1,
"xelionEvent": "newCallEvent"
}, {
"createdAt": "2021-10-25T17:17:58.488524300",
"crmResourcePayload": {
"fromNumber": "${callerPhoneNumber}",
"callerUser": "${callerUser}",
"calleeUser": "${calleeUser}",
"myObject": {
"callId": "${callId}"
},
"calleeFlowId": "${calleeFlowId}",
"toNumber": "${calleePhoneNumber}",
"callerFlowId": "${callerFlowId}"
},
"crmResourceUri": "https://example.org/cti-server-stub/api/salesforce/services/data/v42.0/sobjects/Account",
"id": 3,
"xelionEvent": "callHungUpEvent"
}, {
"createdAt": "2021-10-25T17:17:58.523521200",
"crmResourcePayload": {
"fromNumber": "${callerPhoneNumber}",
"callerUser": "${callerUser}",
"calleeUser": "${calleeUser}",
"myObject": {
"myPayload": "${callId}"
},
"calleeFlowId": "${calleeFlowId}",
"toNumber": "${calleePhoneNumber}",
"callerFlowId": "${callerFlowId}"
},
"crmResourceUri": "https://example.org/cti-server-stub/api/salesforce/services/data/v42.0/sobjects/Resource",
"id": 4,
"xelionEvent": "missedCallEvent"
}, {
"createdAt": "2021-10-25T17:17:58.439525900",
"crmResourcePayload": {
"fromNumber": "${callerPhoneNumber}",
"callerUser": "${callerUser}",
"calleeUser": "${calleeUser}",
"myObject": {
"callId": "${callId}"
},
"calleeFlowId": "${calleeFlowId}",
"toNumber": "${calleePhoneNumber}",
"callerFlowId": "${callerFlowId}"
},
"crmResourceUri": "https://example.org/cti-server-stub/api/salesforce/services/data/v42.0/sobjects/Resource",
"id": 2,
"xelionEvent": "callConnectedEvent"
}
]
PUT api/crm-integrations/{xelionContextId}/crm-contexts/{crmContextId}/event-uri-mappings
Updates the event uri mappings for a given crm context. The number of elements to update must be the same as the ones that are get with the corresponding GET request.
Request
HTTP headers: Authorization: xelion <authorization_token>
Content-Type: application/json
Path parameters: (com.xelion.cti.model.rest.RestContextIdParams)
Request Body: array of (com.xelion.cti.model.rest.request.RestEventUriMapping)
[{
"crmResourceUri": "https://example.org/cti-server-stub/api/zoho/services/crm/v2/phonebridge/callmissed?calleeFlowId=${calleeFlowId}&fromnumber=${callerPhoneNumber}&tonumber=${calleePhoneNumber}",
"xelionEvent": "missedCallEvent",
"crmResourcePayload": null
}, {
"crmResourcePayload": {
"fromNumber": "${callerPhoneNumber}",
"callerUser": "${callerUser}",
"calleeUser": "${calleeUser}",
"myObject": {
"myPayload": "${callId}"
},
"calleeFlowId": "${calleeFlowId}",
"toNumber": "${calleePhoneNumber}",
"callerFlowId": "${callerFlowId}"
},
"crmResourceUri": "https://example.org/cti-server-stub/api/zoho/services/crm/v2/phonebridge/callanswered?callrefid=${callId}&fromnumber=${callerPhoneNumber}&tonumber=${calleePhoneNumber}",
"xelionEvent": "callConnectedEvent"
}, {
"crmResourceUri": "https://example.org/cti-server-stub/api/zoho/services/crm/v2/phonebridge/callhungup?callrefid=${callId}&fromnumber=${callerPhoneNumber}&tonumber=${calleePhoneNumber}&callstarttime=${date}&direction=${(initiation==\"outgoing\")?\"outbound\":\"inbound\"}&duration=30",
"xelionEvent": "callHungUpEvent",
"crmResourcePayload": null
}, {
"crmResourcePayload": {
"fromNumber": "${callerPhoneNumber}",
"callerUser": "${callerUser}",
"calleeUser": "${calleeUser}",
"myObject": {
"callId": "${callId}"
},
"calleeFlowId": "${calleeFlowId}",
"toNumber": "${calleePhoneNumber}",
"callerFlowId": "${callerFlowId}"
},
"crmResourceUri": "https://example.org/cti-server-stub/api/zoho/services/crm/v2/phonebridge/callreceived?callrefid=${callId}&fromnumber=${callerPhoneNumber}&tonumber=${calleePhoneNumber}",
"xelionEvent": "newCallEvent"
}]
Response 200 OK
Content-Type: application/json
Response Body: (com.xelion.cti.model.rest.response.RestEventUriMappingsResponse)