NAV Navigation
Shell Node.js HTTP

Alvaria Cloud Customer Experience Context Cookies REST API v2.0.0

Scroll down for code samples, example requests and responses. Select a language for code samples from the tabs above or the mobile navigation menu.

Overview

The Alvaria™ Cloud Customer Experience REST API, provided by the CX Continuity Server, facilitates easy integration with other systems by providing access to Context Cookies stored in the underlying database. This enables you to, for example:

In order to utilize the Customer Experience REST API the customerexperienceapi scope is required.

Base URLs:

License: License: Creative Commons Attribution 4.0 International Public License

Authentication

Scope Scope Description
customerexperienceapi manage the complete customer experience api
customerexperienceapi.contextcookies manage customer experience - context cookies

Settings

Get Settings

Code samples

# You can also use wget
curl -X GET https://orgId.via.aspect-cloud.net/via/v2/organizations/{orgId}/customerexperience/contextCookies/settings \
  -H 'Accept: application/json' \
  -H 'Authorization: string' \
  -H 'x-api-key: string'

const fetch = require('node-fetch');

const headers = {
  'Accept':'application/json',
  'Authorization':'string',
  'x-api-key':'string'
};

fetch('https://orgId.via.aspect-cloud.net/via/v2/organizations/{orgId}/customerexperience/contextCookies/settings',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

GET https://orgId.via.aspect-cloud.net/via/v2/organizations/{orgId}/customerexperience/contextCookies/settings HTTP/1.1
Host: orgid.via.aspect-cloud.net
Accept: application/json
Authorization: string
x-api-key: string

GET /via/v2/organizations/{orgId}/customerexperience/contextCookies/settings

Returns all settings matching the filters

Parameters

Name In Type Required Description
orgId path string true Name of a customer organization
customer query string false ID of a customer. This is a comma-separated list of customer IDs to use for filtering
service query string false Name of a service. This is a comma-separated list of names of services to filter on. Note that the service can be an empty value, which limits the result set to settings with an empty service name. This is not that same as omitting the filter, which means the result is not limited to specific services
channel query string false Channel type. This is a comma-separated list of channels to use for filtering
key query string false Key name. This is a comma-separated list of keys to use for filtering
lastSessionsOnly query boolean false Whether the result contains information for the last session only. Setting this filter to true limits the result to information about the last session only
customKeysOnly query boolean false Whether the result contains information for Custom keys only. Setting this filter to true limits the result to custom keys only
minimumModificationAge query integer false Minimum modification age. Setting this filter to true limits the result set to anything where the last modified time is older than the minimum modification age
Authorization header string true Authentication token with the value: 'Bearer {accessToken}', where {accessToken} was returned from a call to the authorization endpoint
x-api-key header string true Alvaria-provided value used to track API endpoint usage

Example responses

200 Response

{
  "kind": "cxp#contextCookiesSettingCollection",
  "settings": [
    {
      "customerId": "a",
      "key": "key1",
      "content": "content1",
      "channel": "all",
      "service": "a",
      "expiresOnTime": "2017-05-24T13:35:28.000Z",
      "creationTime": "2017-05-24T13:35:28.000Z",
      "lastModifiedTime": "2017-05-24T13:35:28.000Z"
    }
  ],
  "totalItems": "1"
}

Responses

Status Meaning Description Schema
200 OK Successful response SettingCollection
400 Bad Request Validation exception ErrorResponse
401 Unauthorized Unauthorized None
406 Not Acceptable An output format different from XML and JSON was requested ErrorResponse
429 Too Many Requests Too Many Requests ErrorResponse
500 Internal Server Error Internal server error ErrorResponse

Delete Settings

Code samples

# You can also use wget
curl -X DELETE https://orgId.via.aspect-cloud.net/via/v2/organizations/{orgId}/customerexperience/contextCookies/settings \
  -H 'Accept: application/json' \
  -H 'Authorization: string' \
  -H 'x-api-key: string'

const fetch = require('node-fetch');

const headers = {
  'Accept':'application/json',
  'Authorization':'string',
  'x-api-key':'string'
};

fetch('https://orgId.via.aspect-cloud.net/via/v2/organizations/{orgId}/customerexperience/contextCookies/settings',
{
  method: 'DELETE',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

DELETE https://orgId.via.aspect-cloud.net/via/v2/organizations/{orgId}/customerexperience/contextCookies/settings HTTP/1.1
Host: orgid.via.aspect-cloud.net
Accept: application/json
Authorization: string
x-api-key: string

DELETE /via/v2/organizations/{orgId}/customerexperience/contextCookies/settings

Deletes the settings that match the filters

Parameters

Name In Type Required Description
orgId path string true Name of a customer organization
customer query string false ID of a customer. This is a comma-separated list of customer IDs to use for filtering
service query string false Name of a service. This is a comma-separated list of names of services to filter on. Note that the service can be an empty value, which limits the result set to settings with an empty service name. This is not that same as omitting the filter, which means the result is not limited to specific services
channel query string false Channel type. This is a comma-separated list of channels to use for filtering
key query string false Key name. This is a comma-separated list of keys to use for filtering
lastSessionsOnly query boolean false Whether the result contains information for the last session only. Setting this filter to true limits the result to information about the last session only
customKeysOnly query boolean false Whether the result contains information for Custom keys only. Setting this filter to true limits the result to custom keys only
minimumModificationAge query integer false Minimum modification age. Setting this filter to true limits the result set to anything where the last modified time is older than the minimum modification age
Authorization header string true Authentication token with the value: 'Bearer {accessToken}', where {accessToken} was returned from a call to the authorization endpoint
x-api-key header string true Alvaria-provided value used to track API endpoint usage

Example responses

400 Response

{
  "code": "400",
  "message": "Validation exception",
  "errors": [
    {
      "scope": "global",
      "reason": "Invalid request",
      "message": "The value for the channel is invalid"
    }
  ]
}

Responses

Status Meaning Description Schema
204 No Content Successful response None
400 Bad Request Validation exception ErrorResponse
401 Unauthorized Unauthorized None
406 Not Acceptable An output format different from XML and JSON was requested ErrorResponse
429 Too Many Requests Too Many Requests ErrorResponse
500 Internal Server Error Internal server error ErrorResponse

Post Settings

Code samples

# You can also use wget
curl -X POST https://orgId.via.aspect-cloud.net/via/v2/organizations/{orgId}/customerexperience/contextCookies/settings \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -H 'Authorization: string' \
  -H 'x-api-key: string'

const fetch = require('node-fetch');
const inputBody = {
  "settings": [
    {
      "customerId": "a",
      "key": "key1",
      "content": "content1",
      "channel": "voice",
      "service": "b",
      "expiresOnTime": "2017-05-24T13:35:28.000Z"
    }
  ]
};
const headers = {
  'Content-Type':'application/json',
  'Accept':'application/json',
  'Authorization':'string',
  'x-api-key':'string'
};

fetch('https://orgId.via.aspect-cloud.net/via/v2/organizations/{orgId}/customerexperience/contextCookies/settings',
{
  method: 'POST',
  body: JSON.stringify(inputBody),
  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

POST https://orgId.via.aspect-cloud.net/via/v2/organizations/{orgId}/customerexperience/contextCookies/settings HTTP/1.1
Host: orgid.via.aspect-cloud.net
Content-Type: application/json
Accept: application/json
Authorization: string
x-api-key: string

POST /via/v2/organizations/{orgId}/customerexperience/contextCookies/settings

Creates or modifies settings for the customer. The POST method is transactional, which means that either all settings in the payload are created or updated or none of the settings. A failure to create or update one setting results in a complete rollback

Body parameter

{
  "settings": [
    {
      "customerId": "a",
      "key": "key1",
      "content": "content1",
      "channel": "voice",
      "service": "b",
      "expiresOnTime": "2017-05-24T13:35:28.000Z"
    }
  ]
}

Parameters

Name In Type Required Description
orgId path string true Name of a customer organization
Authorization header string true Authentication token with the value: 'Bearer {accessToken}', where {accessToken} was returned from a call to the authorization endpoint
x-api-key header string true Alvaria-provided value used to track API endpoint usage
body body SettingCollectionModify true none

Example responses

400 Response

{
  "code": "400",
  "message": "Validation exception",
  "errors": [
    {
      "scope": "global",
      "reason": "Invalid request",
      "message": "The value for the channel is invalid"
    }
  ]
}

Responses

Status Meaning Description Schema
204 No Content Successful response None
400 Bad Request Validation exception ErrorResponse
401 Unauthorized Unauthorized None
406 Not Acceptable An output format different from XML and JSON was requested ErrorResponse
429 Too Many Requests Too Many Requests ErrorResponse
500 Internal Server Error Internal server error ErrorResponse

Customers

Get Customers

Code samples

# You can also use wget
curl -X GET https://orgId.via.aspect-cloud.net/via/v2/organizations/{orgId}/customerexperience/contextCookies/customers \
  -H 'Accept: application/json' \
  -H 'Authorization: string' \
  -H 'x-api-key: string'

const fetch = require('node-fetch');

const headers = {
  'Accept':'application/json',
  'Authorization':'string',
  'x-api-key':'string'
};

fetch('https://orgId.via.aspect-cloud.net/via/v2/organizations/{orgId}/customerexperience/contextCookies/customers',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

GET https://orgId.via.aspect-cloud.net/via/v2/organizations/{orgId}/customerexperience/contextCookies/customers HTTP/1.1
Host: orgid.via.aspect-cloud.net
Accept: application/json
Authorization: string
x-api-key: string

GET /via/v2/organizations/{orgId}/customerexperience/contextCookies/customers

Returns all customers matching the filters

Parameters

Name In Type Required Description
orgId path string true Name of a customer organization
service query string false Name of a service. This is a comma-separated list of names of services to filter on. Note that the service can be an empty value, which limits the result set to settings with an empty service name. This is not that same as omitting the filter, which means the result is not limited to specific services
channel query string false Channel type. This is a comma-separated list of channels to use for filtering
key query string false Key name. This is a comma-separated list of keys to use for filtering
lastSessionsOnly query boolean false Whether the result contains information for the last session only. Setting this filter to true limits the result to information about the last session only
customKeysOnly query boolean false Whether the result contains information for Custom keys only. Setting this filter to true limits the result to custom keys only
Authorization header string true Authentication token with the value: 'Bearer {accessToken}', where {accessToken} was returned from a call to the authorization endpoint
x-api-key header string true Alvaria-provided value used to track API endpoint usage

Example responses

200 Response

{
  "kind": "cxp#contextCookiesCustomerCollection",
  "customers": [
    {
      "id": "customer1"
    }
  ],
  "totalItems": "1"
}

Responses

Status Meaning Description Schema
200 OK Successful response CustomerCollection
400 Bad Request Validation exception ErrorResponse
401 Unauthorized Unauthorized None
406 Not Acceptable An output format different from XML and JSON was requested ErrorResponse
429 Too Many Requests Too Many Requests ErrorResponse
500 Internal Server Error Internal server error ErrorResponse

Services

Get Services

Code samples

# You can also use wget
curl -X GET https://orgId.via.aspect-cloud.net/via/v2/organizations/{orgId}/customerexperience/contextCookies/services \
  -H 'Accept: application/json' \
  -H 'Authorization: string' \
  -H 'x-api-key: string'

const fetch = require('node-fetch');

const headers = {
  'Accept':'application/json',
  'Authorization':'string',
  'x-api-key':'string'
};

fetch('https://orgId.via.aspect-cloud.net/via/v2/organizations/{orgId}/customerexperience/contextCookies/services',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

GET https://orgId.via.aspect-cloud.net/via/v2/organizations/{orgId}/customerexperience/contextCookies/services HTTP/1.1
Host: orgid.via.aspect-cloud.net
Accept: application/json
Authorization: string
x-api-key: string

GET /via/v2/organizations/{orgId}/customerexperience/contextCookies/services

Returns all services

Parameters

Name In Type Required Description
orgId path string true Name of a customer organization
customer query string false ID of a customer. This is a comma-separated list of customer IDs to use for filtering
channel query string false Channel type. This is a comma-separated list of channels to use for filtering
key query string false Key name. This is a comma-separated list of keys to use for filtering
Authorization header string true Authentication token with the value: 'Bearer {accessToken}', where {accessToken} was returned from a call to the authorization endpoint
x-api-key header string true Alvaria-provided value used to track API endpoint usage

Example responses

200 Response

{
  "kind": "cxp#contextCookiesServiceCollection",
  "services": [
    {
      "id": "service1"
    }
  ],
  "totalItems": "1"
}

Responses

Status Meaning Description Schema
200 OK Successful response ServiceCollection
400 Bad Request Validation exception ErrorResponse
401 Unauthorized Unauthorized None
406 Not Acceptable An output format different from XML and JSON was requested ErrorResponse
429 Too Many Requests Too Many Requests ErrorResponse
500 Internal Server Error Internal server error ErrorResponse

Channels

Get Channels

Code samples

# You can also use wget
curl -X GET https://orgId.via.aspect-cloud.net/via/v2/organizations/{orgId}/customerexperience/contextCookies/channels \
  -H 'Accept: application/json' \
  -H 'Authorization: string' \
  -H 'x-api-key: string'

const fetch = require('node-fetch');

const headers = {
  'Accept':'application/json',
  'Authorization':'string',
  'x-api-key':'string'
};

fetch('https://orgId.via.aspect-cloud.net/via/v2/organizations/{orgId}/customerexperience/contextCookies/channels',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

GET https://orgId.via.aspect-cloud.net/via/v2/organizations/{orgId}/customerexperience/contextCookies/channels HTTP/1.1
Host: orgid.via.aspect-cloud.net
Accept: application/json
Authorization: string
x-api-key: string

GET /via/v2/organizations/{orgId}/customerexperience/contextCookies/channels

Returns all channels

Parameters

Name In Type Required Description
orgId path string true Name of a customer organization
customer query string false ID of a customer. This is a comma-separated list of customer IDs to use for filtering
service query string false Name of a service. This is a comma-separated list of names of services to filter on. Note that the service can be an empty value, which limits the result set to settings with an empty service name. This is not that same as omitting the filter, which means the result is not limited to specific services
key query string false Key name. This is a comma-separated list of keys to use for filtering
Authorization header string true Authentication token with the value: 'Bearer {accessToken}', where {accessToken} was returned from a call to the authorization endpoint
x-api-key header string true Alvaria-provided value used to track API endpoint usage

Example responses

200 Response

{
  "kind": "cxp#contextCookiesChannelCollection",
  "channels": [
    {
      "id": "all"
    }
  ],
  "totalItems": "1"
}

Responses

Status Meaning Description Schema
200 OK Successful response ChannelCollection
400 Bad Request Validation exception ErrorResponse
401 Unauthorized Unauthorized None
406 Not Acceptable An output format different from XML and JSON was requested ErrorResponse
429 Too Many Requests Too Many Requests ErrorResponse
500 Internal Server Error Internal server error ErrorResponse

Schemas

SettingCollection

{
  "kind": "cxp#contextCookiesSettingCollection",
  "settings": [
    {
      "customerId": "a",
      "key": "key1",
      "content": "content1",
      "channel": "all",
      "service": "a",
      "expiresOnTime": "2017-05-24T13:35:28.000Z",
      "creationTime": "2017-05-24T13:35:28.000Z",
      "lastModifiedTime": "2017-05-24T13:35:28.000Z"
    }
  ],
  "totalItems": "1"
}

Properties

Name Type Required Restrictions Description
kind string false none Identifier used by Alvaria™ Cloud components to serialize the payload of the results
settings [object] false none An array of settings
» customerId string false none Identifier of a customer
» key string false none Key to identify the setting
» content string false none Content of this setting
» channel string false none Channel for this setting
» service string false none Service for this setting
» expiresOnTime string(date-time) false none Expiration date and time of the setting, specified in ISO 8601 format and in UTC time zone (1985-04-12T23:20:50.525Z)
» creationTime string(date-time) false none Date and time the setting was created, specified in ISO 8601 format and in UTC time zone (1985-04-12T23:20:50.525Z)
» lastModifiedTime string(date-time) false none Date and time of the most recent change to the setting, specified in ISO 8601 format and in UTC time zone (1985-04-12T23:20:50.525Z)
totalItems integer false none Total number of items returned in the result

SettingCollectionModify

{
  "settings": [
    {
      "customerId": "a",
      "key": "key1",
      "content": "content1",
      "channel": "voice",
      "service": "b",
      "expiresOnTime": "2017-05-24T13:35:28.000Z"
    }
  ]
}

Properties

Name Type Required Restrictions Description
settings [object] false none An array of settings
» customerId string false none Identifier of a customer
» key string false none Key to identify the setting
» content string false none Content of this setting
» channel string false none Channel type for this setting. The channel type must be supported by CXP
» service string false none Service for this setting that is associated with CXP
» expiresOnTime string(date-time) false none Expiration date and time of the setting, specified in ISO 8601 format and in UTC time zone (1985-04-12T23:20:50.525Z)

CustomerCollection

{
  "kind": "cxp#contextCookiesCustomerCollection",
  "customers": [
    {
      "id": "customer1"
    }
  ],
  "totalItems": "1"
}

Properties

Name Type Required Restrictions Description
kind string false none Identifier used by Alvaria™ Cloud components to serialize the payload of the results
customers [object] false none List of customers
» id string false none Unique ID to identify the customer
totalItems integer false none Total number of items returned in the result

ServiceCollection

{
  "kind": "cxp#contextCookiesServiceCollection",
  "services": [
    {
      "id": "service1"
    }
  ],
  "totalItems": "1"
}

Properties

Name Type Required Restrictions Description
kind string false none Identifier used by Alvaria™ Cloud components to serialize the payload of the results
services [object] false none List of services
» id string false none Unique ID to identify the service
totalItems integer false none Total number of items returned in the result

ChannelCollection

{
  "kind": "cxp#contextCookiesChannelCollection",
  "channels": [
    {
      "id": "all"
    }
  ],
  "totalItems": "1"
}

Properties

Name Type Required Restrictions Description
kind string false none Identifier used by Alvaria™ Cloud components to serialize the payload of the results
channels [object] false none List of channels
» id string false none Unique ID to identify the channel
totalItems integer false none Total number of items returned in the result

ErrorResponse

{
  "code": "400",
  "message": "Validation exception",
  "errors": [
    {
      "scope": "global",
      "reason": "Invalid request",
      "message": "The value for the channel is invalid"
    }
  ]
}

Properties

Name Type Required Restrictions Description
code integer false none HTTP error status
message string false none none
errors [Error] false none none

Error

{
  "scope": "global",
  "reason": "Invalid request",
  "message": "The value for the channel is invalid"
}

Properties

Name Type Required Restrictions Description
scope string false none none
reason string false none none
message string false none none