swagger: '2.0'
info:
  version: 2.0.0
  title: Alvaria Cloud Customer Experience Context Cookies REST API
  contact:
    name: Alvaria Software
    url: 'https://www.alvaria.com'
    email: support@alvaria.com
  license:
    name: 'License: Creative Commons Attribution 4.0 International Public License'
    url: 'https://creativecommons.org/licenses/by/4.0/legalcode'
  description: |-
    ## Overview

    The Alvaria&trade; 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:

    * Pre-populate Context Cookies with information derived from CRM systems.
    * Share Context Cookies with third-party systems.
    * Run scheduled maintenance operations on the Context Cookies repository to clean out entries that are no longer needed.

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

host: orgId.via.aspect-cloud.net
schemes:
  - https
consumes:
  - application/json
produces:
  - application/json
paths:
  '/via/v2/organizations/{orgId}/customerexperience/contextCookies/settings':
    get:
      tags:
        - Settings
      operationId: Get Settings
      summary: Get Settings
      description: Returns all settings matching the filters
      parameters:
        - name: orgId
          in: path
          description: Name of a customer organization
          required: true
          type: string
        - name: customer
          in: query
          description: ID of a customer. This is a comma-separated list of customer IDs to use for filtering
          required: false
          type: string
        - name: service
          in: query
          description: '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'
          required: false
          type: string
        - name: channel
          in: query
          description: Channel type. This is a comma-separated list of channels to use for filtering
          required: false
          type: string
        - name: key
          in: query
          description: Key name. This is a comma-separated list of keys to use for filtering
          required: false
          type: string
        - name: lastSessionsOnly
          in: query
          description: 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
          required: false
          type: boolean
        - name: customKeysOnly
          in: query
          description: Whether the result contains information for Custom keys only. Setting this filter to true limits the result to custom keys only
          required: false
          type: boolean
        - name: minimumModificationAge
          in: query
          description: 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
          required: false
          type: integer
        - name: Authorization
          in: header
          description: |-
            Authentication token with the value: 'Bearer {accessToken}', where {accessToken} was returned from a call to the authorization endpoint
          required: true
          type: string
        - name: x-api-key
          in: header
          required: true
          type: string
          description: Alvaria-provided value used to track API endpoint usage
      security:
        - oauth:
            - customerexperienceapi
      responses:
        '200':
          description: Successful response
          schema:
            $ref: '#/definitions/SettingCollection'
        '400':
          description: Validation exception
          schema:
            $ref: '#/definitions/ErrorResponse'
        '401':
          description: Unauthorized
        '406':
          description: An output format different from XML and JSON was requested
          schema:
            $ref: '#/definitions/ErrorResponse'
        '429':
          description: Too Many Requests
          schema:
            $ref: '#/definitions/ErrorResponse'
        '500':
          description: Internal server error
          schema:
            $ref: '#/definitions/ErrorResponse'
    delete:
      tags:
        - Settings
      operationId: Delete Settings
      summary: Delete Settings
      description: Deletes the settings that match the filters
      parameters:
        - name: orgId
          in: path
          description: Name of a customer organization
          required: true
          type: string
        - name: customer
          in: query
          description: ID of a customer. This is a comma-separated list of customer IDs to use for filtering
          required: false
          type: string
        - name: service
          in: query
          description: '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'
          required: false
          type: string
        - name: channel
          in: query
          description: Channel type. This is a comma-separated list of channels to use for filtering
          required: false
          type: string
        - name: key
          in: query
          description: Key name. This is a comma-separated list of keys to use for filtering
          required: false
          type: string
        - name: lastSessionsOnly
          in: query
          description: 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
          required: false
          type: boolean
        - name: customKeysOnly
          in: query
          description: Whether the result contains information for Custom keys only. Setting this filter to true limits the result to custom keys only
          required: false
          type: boolean
        - name: minimumModificationAge
          in: query
          description: 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
          required: false
          type: integer
        - name: Authorization
          in: header
          description: |-
            Authentication token with the value: 'Bearer {accessToken}', where {accessToken} was returned from a call to the authorization endpoint
          required: true
          type: string
        - name: x-api-key
          in: header
          required: true
          type: string
          description: Alvaria-provided value used to track API endpoint usage
      security:
        - oauth:
            - customerexperienceapi
      responses:
        '204':
          description: Successful response
        '400':
          description: Validation exception
          schema:
            $ref: '#/definitions/ErrorResponse'
        '401':
          description: Unauthorized
        '406':
          description: An output format different from XML and JSON was requested
          schema:
            $ref: '#/definitions/ErrorResponse'
        '429':
          description: Too Many Requests
          schema:
            $ref: '#/definitions/ErrorResponse'
        '500':
          description: Internal server error
          schema:
            $ref: '#/definitions/ErrorResponse'
    post:
      tags:
        - Settings
      operationId: Post Settings
      summary: Post Settings
      description: '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'
      parameters:
        - name: orgId
          in: path
          description: Name of a customer organization
          required: true
          type: string
        - name: Authorization
          in: header
          description: |-
            Authentication token with the value: 'Bearer {accessToken}', where {accessToken} was returned from a call to the authorization endpoint
          required: true
          type: string
        - name: x-api-key
          in: header
          required: true
          type: string
          description: Alvaria-provided value used to track API endpoint usage
        - name: body
          in: body
          required: true
          schema:
            $ref: '#/definitions/SettingCollectionModify'
      security:
        - oauth:
            - customerexperienceapi
      responses:
        '204':
          description: Successful response
        '400':
          description: Validation exception
          schema:
            $ref: '#/definitions/ErrorResponse'
        '401':
          description: Unauthorized
        '406':
          description: An output format different from XML and JSON was requested
          schema:
            $ref: '#/definitions/ErrorResponse'
        '429':
          description: Too Many Requests
          schema:
            $ref: '#/definitions/ErrorResponse'
        '500':
          description: Internal server error
          schema:
            $ref: '#/definitions/ErrorResponse'
  '/via/v2/organizations/{orgId}/customerexperience/contextCookies/customers':
    get:
      tags:
        - Customers
      operationId: Get Customers
      summary: Get Customers
      description: Returns all customers matching the filters
      parameters:
        - name: orgId
          in: path
          description: Name of a customer organization
          required: true
          type: string
        - name: service
          in: query
          description: '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'
          required: false
          type: string
        - name: channel
          in: query
          description: Channel type. This is a comma-separated list of channels to use for filtering
          required: false
          type: string
        - name: key
          in: query
          description: Key name. This is a comma-separated list of keys to use for filtering
          required: false
          type: string
        - name: lastSessionsOnly
          in: query
          description: 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
          required: false
          type: boolean
        - name: customKeysOnly
          in: query
          description: Whether the result contains information for Custom keys only. Setting this filter to true limits the result to custom keys only
          required: false
          type: boolean
        - name: Authorization
          in: header
          description: |-
            Authentication token with the value: 'Bearer {accessToken}', where {accessToken} was returned from a call to the authorization endpoint
          required: true
          type: string
        - name: x-api-key
          in: header
          required: true
          type: string
          description: Alvaria-provided value used to track API endpoint usage
      security:
        - oauth:
            - customerexperienceapi
      responses:
        '200':
          description: Successful response
          schema:
            $ref: '#/definitions/CustomerCollection'
        '400':
          description: Validation exception
          schema:
            $ref: '#/definitions/ErrorResponse'
        '401':
          description: Unauthorized
        '406':
          description: An output format different from XML and JSON was requested
          schema:
            $ref: '#/definitions/ErrorResponse'
        '429':
          description: Too Many Requests
          schema:
            $ref: '#/definitions/ErrorResponse'
        '500':
          description: Internal server error
          schema:
            $ref: '#/definitions/ErrorResponse'
  '/via/v2/organizations/{orgId}/customerexperience/contextCookies/services':
    get:
      tags:
        - Services
      operationId: Get Services
      summary: Get Services
      description: Returns all services
      parameters:
        - name: orgId
          in: path
          description: Name of a customer organization
          required: true
          type: string
        - name: customer
          in: query
          description: ID of a customer. This is a comma-separated list of customer IDs to use for filtering
          required: false
          type: string
        - name: channel
          in: query
          description: Channel type. This is a comma-separated list of channels to use for filtering
          required: false
          type: string
        - name: key
          in: query
          description: Key name. This is a comma-separated list of keys to use for filtering
          required: false
          type: string
        - name: Authorization
          in: header
          description: |-
            Authentication token with the value: 'Bearer {accessToken}', where {accessToken} was returned from a call to the authorization endpoint
          required: true
          type: string
        - name: x-api-key
          in: header
          required: true
          type: string
          description: Alvaria-provided value used to track API endpoint usage
      security:
        - oauth:
            - customerexperienceapi
      responses:
        '200':
          description: Successful response
          schema:
            $ref: '#/definitions/ServiceCollection'
        '400':
          description: Validation exception
          schema:
            $ref: '#/definitions/ErrorResponse'
        '401':
          description: Unauthorized
        '406':
          description: An output format different from XML and JSON was requested
          schema:
            $ref: '#/definitions/ErrorResponse'
        '429':
          description: Too Many Requests
          schema:
            $ref: '#/definitions/ErrorResponse'
        '500':
          description: Internal server error
          schema:
            $ref: '#/definitions/ErrorResponse'
  '/via/v2/organizations/{orgId}/customerexperience/contextCookies/channels':
    get:
      tags:
        - Channels
      operationId: Get Channels
      summary: Get Channels
      description: Returns all channels
      parameters:
        - name: orgId
          in: path
          description: Name of a customer organization
          required: true
          type: string
        - name: customer
          in: query
          description: ID of a customer. This is a comma-separated list of customer IDs to use for filtering
          required: false
          type: string
        - name: service
          in: query
          description: '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'
          required: false
          type: string
        - name: key
          in: query
          description: Key name. This is a comma-separated list of keys to use for filtering
          required: false
          type: string
        - name: Authorization
          in: header
          description: |-
            Authentication token with the value: 'Bearer {accessToken}', where {accessToken} was returned from a call to the authorization endpoint
          required: true
          type: string
        - name: x-api-key
          in: header
          required: true
          type: string
          description: Alvaria-provided value used to track API endpoint usage
      security:
        - oauth:
            - customerexperienceapi
      responses:
        '200':
          description: Successful response
          schema:
            $ref: '#/definitions/ChannelCollection'
        '400':
          description: Validation exception
          schema:
            $ref: '#/definitions/ErrorResponse'
        '401':
          description: Unauthorized
        '406':
          description: An output format different from XML and JSON was requested
          schema:
            $ref: '#/definitions/ErrorResponse'
        '429':
          description: Too Many Requests
          schema:
            $ref: '#/definitions/ErrorResponse'
        '500':
          description: Internal server error
          schema:
            $ref: '#/definitions/ErrorResponse'
securityDefinitions:
  oauth:
    type: oauth2
    authorizationUrl: 'https://myaspect.{region}.id.aspect-cloud.net/tokenservice/oauth2/access_token?realm={orgId}'
    flow: implicit
    scopes:
      customerexperienceapi: manage the complete customer experience api
      customerexperienceapi.contextcookies: manage customer experience - context cookies
definitions:
  SettingCollection:
    type: object
    properties:
      kind:
        description: Identifier used by Alvaria&trade; Cloud components to serialize the payload of the results
        type: string
        default: 'cxp#contextCookiesSettingCollection'
        example: 'cxp#contextCookiesSettingCollection'
      settings:
        type: array
        description: An array of settings
        items:
          type: object
          properties:
            customerId:
              description: Identifier of a customer
              type: string
              example: a
            key:
              description: Key to identify the setting
              type: string
              example: key1
            content:
              description: Content of this setting
              type: string
              example: content1
            channel:
              description: Channel for this setting
              type: string
              example: all
            service:
              description: Service for this setting
              type: string
              example: a
            expiresOnTime:
              description: 'Expiration date and time of the setting, specified in ISO 8601 format and in UTC time zone (1985-04-12T23:20:50.525Z)'
              type: string
              format: date-time
              example: '2017-05-24T13:35:28.000Z'
            creationTime:
              description: 'Date and time the setting was created, specified in ISO 8601 format and in UTC time zone (1985-04-12T23:20:50.525Z)'
              type: string
              format: date-time
              example: '2017-05-24T13:35:28.000Z'
            lastModifiedTime:
              description: '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)'
              type: string
              format: date-time
              example: '2017-05-24T13:35:28.000Z'
      totalItems:
        description: Total number of items returned in the result
        type: integer
        example: '1'
  SettingCollectionModify:
    type: object
    properties:
      settings:
        type: array
        description: An array of settings
        items:
          type: object
          properties:
            customerId:
              description: Identifier of a customer
              type: string
              example: a
            key:
              description: Key to identify the setting
              type: string
              example: key1
            content:
              description: Content of this setting
              type: string
              example: content1
            channel:
              description: Channel type for this setting. The channel type must be supported by CXP
              type: string
              example: voice
            service:
              description: Service for this setting that is associated with CXP
              type: string
              example: b
            expiresOnTime:
              description: 'Expiration date and time of the setting, specified in ISO 8601 format and in UTC time zone (1985-04-12T23:20:50.525Z)'
              type: string
              format: date-time
              example: '2017-05-24T13:35:28.000Z'
  CustomerCollection:
    type: object
    properties:
      kind:
        description: Identifier used by Alvaria&trade; Cloud components to serialize the payload of the results
        type: string
        default: 'cxp#contextCookiesCustomerCollection'
        example: 'cxp#contextCookiesCustomerCollection'
      customers:
        type: array
        description: List of customers
        items:
          type: object
          properties:
            id:
              description: Unique ID to identify the customer
              type: string
              example: customer1
      totalItems:
        description: Total number of items returned in the result
        type: integer
        example: '1'
  ServiceCollection:
    type: object
    properties:
      kind:
        description: Identifier used by Alvaria&trade; Cloud components to serialize the payload of the results
        type: string
        default: 'cxp#contextCookiesServiceCollection'
        example: 'cxp#contextCookiesServiceCollection'
      services:
        type: array
        description: List of services
        items:
          type: object
          properties:
            id:
              description: Unique ID to identify the service
              type: string
              example: service1
      totalItems:
        description: Total number of items returned in the result
        type: integer
        example: '1'
  ChannelCollection:
    type: object
    properties:
      kind:
        description: Identifier used by Alvaria&trade; Cloud components to serialize the payload of the results
        type: string
        default: 'cxp#contextCookiesChannelCollection'
        example: 'cxp#contextCookiesChannelCollection'
      channels:
        type: array
        description: List of channels
        items:
          type: object
          properties:
            id:
              description: Unique ID to identify the channel
              type: string
              example: all
      totalItems:
        description: Total number of items returned in the result
        type: integer
        example: '1'
  ErrorResponse:
    type: object
    properties:
      code:
        type: integer
        description: HTTP error status
        example: '400'
      message:
        type: string
        example: Validation exception
      errors:
        type: array
        items:
          $ref: '#/definitions/Error'
  Error:
    type: object
    properties:
      scope:
        type: string
        example: global
      reason:
        type: string
        example: Invalid request
      message:
        type: string
        example: The value for the channel is invalid
