swagger: '2.0'
info:
  version: 2.0.0
  title: Alvaria Cloud Reporting REST API
  contact:
    name: Alvaria
    url: 'http://www.alvaria.com'
  license:
    name: 'License: Creative Commons Attribution 4.0 International Public License'
    url: 'https://creativecommons.org/licenses/by/4.0/legalcode'
  description: 'The Alvaria&trade; Cloud Omni Reporting Real-Time Data Query API (query API)  provides a RESTFUL approach to extract data from the Alvaria&trade; Cloud Real-Time Reporting platform. Each query (REST endpoint) is a representation of a specific view of the data within the real-time reporting platform. When accessed by the client, the results provide a snapshot of the data being requested, at that point in time. In order to utilize the Reporting APIs the reportingapi scope is required.'
host: orgId.via.aspect-cloud.net
schemes:
  - https
consumes:
  - application/json
produces:
  - application/json
paths:
  '/via/v2/organizations/{orgId}/reporting/queries/listActivity/data':
    get:
      summary: 'Get ListActivity'
      tags:
        - Data
      description: "This operation returns the following List Activity Statistics:- recordsAvailable - Records available to dial - recordsAttempted - Records that were dialled at least once - recordsInActive - Records that are with the dialler - callsBusy - Records that must be re-attempted - listPenetration - Percentage of records that have been dialed at least once. - listSaturation - Saturation is the number of contact attempts divided by the number of records attempted (as a percentage) - passcountPenetration - Percentage of records that have been dialed at least once for the dynamic list - passcountSaturation - Saturation is the number of contact attempts divided by the number of records attempted (as a percentage) for the dynamic lists"
      operationId: Get ListActivity
      parameters:
        - name: orgId
          in: path
          description: Name of a customer organization
          required: true
          type: string
        - name: contactList
          in: query
          description: 'Name of a contact list on which to report. To find the contact list name, a GET /campaign/lists call must be made to retrieve a contactList collection.  Within this collection, contactLists[x].name, is the name of the contact list.'
          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&trade; provided value used to track API endpoint usage
      responses:
        '200':
          description: Successful response
          schema:
            $ref: '#/definitions/CollectionListActivityResponse'
        '400':
          description: Bad Request
          schema:
            $ref: '#/definitions/ErrorResponse'
        '401':
          description: Unauthorized
          schema:
            $ref: '#/definitions/ErrorResponse'
        '404':
          description: No ListActivity exists for the provided entity Id
          schema:
            $ref: '#/definitions/ErrorResponse'
        '405':
          description: Method Not Allowed
          schema:
            $ref: '#/definitions/ErrorResponse'
        '408':
          description: Request Timeout
          schema:
            $ref: '#/definitions/ErrorResponse'
        '429':
          schema:
            $ref: '#/definitions/ErrorResponse'
          description: Throttled
        '500':
          description: Internal server error
          schema:
            $ref: '#/definitions/ErrorResponse'
      security:
        - oauth:
            - reportingapi
  '/via/v2/organizations/{orgId}/reporting/queries/teamActivity/data':
    get:
      summary: 'Get teamActivity'
      tags:
        - Data
      description: 'Gets the current snapshot of activity metrics for the team instance that was requested. Note: If you see any success response with 0 rows, it might be team manager/owner not in the requested team.'
      operationId: Get teamActivity
      parameters:
        - name: orgId
          in: path
          description: Name of a customer organization
          required: true
          type: string
        - name: teamId
          in: query
          description: 'Alvaria&trade; generated unique identifier for the team instance. The ID can be determined through the GET /via/v2/organizations/{orgId}/provisioning/teams endpoint.'
          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&trade; provided value used to track API endpoint usage
      responses:
        '200':
          description: Successful response
          schema:
            $ref: '#/definitions/teamActivity'
        '400':
          description: Bad Request
          schema:
            $ref: '#/definitions/ErrorResponse'
        '401':
          description: Unauthorized
          schema:
            $ref: '#/definitions/ErrorResponse'
        '404':
          description: Not Found
          schema:
            $ref: '#/definitions/ErrorResponse'
        '405':
          description: Method Not Allowed
          schema:
            $ref: '#/definitions/ErrorResponse'
        '408':
          description: Request Timeout
          schema:
            $ref: '#/definitions/ErrorResponse'
        '429':
          schema:
            $ref: '#/definitions/ErrorResponse'
          description: Throttled
        '500':
          description: Internal server error
          schema:
            $ref: '#/definitions/ErrorResponse'
      security:
        - oauth:
            - reportingapi
  '/via/v2/organizations/{orgId}/reporting/queries/userActivity/data':
    get:
      summary: 'Get userActivity'
      tags:
        - Data
      description: 'Gets the current snapshot of user activity metrics for the team instance that was requested. Note: If you see any success response with 0 rows, it might be team manager/owner not in the requested team.'
      operationId: Get userActivity
      parameters:
        - name: orgId
          in: path
          description: Name of a customer organization
          required: true
          type: string
        - name: teamId
          in: query
          description: 'Alvaria&trade; generated unique identifier for the team instance. The ID can be determined through the GET /via/v2/organizations/{orgId}/provisioning/teams endpoint.'
          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: tzOffset
          in: query
          description: 'The timezone offset, from UTC, to be applied (using ISO-8601 notation). Examples: ''+01:00'',''+02'',''-00:30''. This string can potentially contain special chars (ex: ''+''), so it''s advisable to encode the value being passed in. Accepted formats are : ''Z- for UTC'', ''+h'', ''+hh'', ''+hh:mm'', ''-hh:mm'', ''+hhmm'', ''-hhmm'', ''-hhmm'', ''+hh:mm:ss'', ''-hh:mm:ss'', ''+hhmmss'', ''-hhmmss'''
          required: false
          type: string
        - name: x-api-key
          in: header
          required: true
          type: string
          description: Alvaria&trade; provided value used to track API endpoint usage
      responses:
        '200':
          description: Successful response
          schema:
            $ref: '#/definitions/userActivity'
        '400':
          description: Bad Request
          schema:
            $ref: '#/definitions/ErrorResponse'
        '401':
          description: Unauthorized
          schema:
            $ref: '#/definitions/ErrorResponse'
        '404':
          description: No ListActivity exists for the provided entity Id
          schema:
            $ref: '#/definitions/ErrorResponse'
        '405':
          description: Method Not Allowed
          schema:
            $ref: '#/definitions/ErrorResponse'
        '408':
          description: Request Timeout
          schema:
            $ref: '#/definitions/ErrorResponse'
        '429':
          schema:
            $ref: '#/definitions/ErrorResponse'
          description: Throttled
        '500':
          description: Internal server error
          schema:
            $ref: '#/definitions/ErrorResponse'
      security:
        - oauth:
            - reportingapi
  '/via/v2/organizations/{orgId}/reporting/queries/channelActivity/data':
    get:
      summary: 'Get channelActivity'
      tags:
        - Data
      description: Gets the current snapshot of channel activity metrics for the Worktype instance that was requested.
      operationId: Get channelActivity
      parameters:
        - name: orgId
          in: path
          description: Name of a customer organization
          required: true
          type: string
        - name: workTypeId
          in: query
          description: 'Alvaria&trade; generated unique identifier for the Worktype instance. The ID can be determined through the GET /via/v2/organizations/{orgId}/provisioning/workTypes endpoint.'
          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&trade; provided value used to track API endpoint usage
      responses:
        '200':
          description: Successful response
          schema:
            $ref: '#/definitions/channelActivity'
        '400':
          description: Bad Request
          schema:
            $ref: '#/definitions/ErrorResponse'
        '401':
          description: Unauthorized
          schema:
            $ref: '#/definitions/ErrorResponse'
        '404':
          description: No ListActivity exists for the provided entity Id
          schema:
            $ref: '#/definitions/ErrorResponse'
        '405':
          description: Method Not Allowed
          schema:
            $ref: '#/definitions/ErrorResponse'
        '408':
          description: Request Timeout
          schema:
            $ref: '#/definitions/ErrorResponse'
        '429':
          schema:
            $ref: '#/definitions/ErrorResponse'
          description: Throttled
        '500':
          description: Internal server error
          schema:
            $ref: '#/definitions/ErrorResponse'
      security:
        - oauth:
            - reportingapi
  '/via/v2/organizations/{orgId}/reporting/presence/users/data':
    parameters:
      - $ref: '#/parameters/orgId'
      - $ref: '#/parameters/authorization'
      - $ref: '#/parameters/x-api-key'
    get:
      summary: 'Get usersList'
      tags:
        - Data
      operationId: Get usersList
      description: Used to get a list of logged in users associated with a workType and also used to get the list of  logged in users regardless of workType.
      consumes:
        - application/json
      parameters:
        - name: state
          required: true
          in: query
          description: 'Logged state of the agent, LoggedOn -1'
          type: string
          enum:
            - LoggedOn
          default: LoggedOn
        - name: workTypeId
          required: false
          in: query
          description: '''Alvaria&trade; generated unique ID for a work type.example: shortname.104.'''
          type: string
      responses:
        '200':
          description: Success - OK
          schema:
            $ref: '#/definitions/UsersCollection'
          headers:
            Access-Control-Allow-Origin:
              type: string
        '400':
          description: Client Error - Bad Request
          schema:
            $ref: '#/definitions/ErrorResponse'
        '401':
          description: Client Error - Unauthorized
        '404':
          description: Client Error - Not Found
          schema:
            $ref: '#/definitions/ErrorResponse'
        '405':
          description: Client Error - Method Not Allowed
          schema:
            $ref: '#/definitions/ErrorResponse'
        '429':
          description: Client Error - Too Many Requests
          schema:
            $ref: '#/definitions/ErrorResponse'
        '500':
          description: Server Error - Internal Server Error
          schema:
            $ref: '#/definitions/ErrorResponse'
        '503':
          description: Server Error - Service Unavailable
          schema:
            $ref: '#/definitions/ErrorResponse'
      security:
        - oauth:
            - reportingapi
securityDefinitions:
  oauth:
    type: oauth2
    authorizationUrl: 'https://myaspect.{region}.id.aspect-cloud.net/tokenservice/oauth2/access_token?realm={orgId}'
    flow: implicit
    scopes:
      reportingapi: request the reporting resource
parameters:
  authorization:
    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
  orgId:
    name: orgId
    in: path
    description: Name of a customer organization.
    required: true
    type: string
  x-api-key:
    name: x-api-key
    in: header
    description: Alvaria&trade; provided value used to track API endpoint usage.
    required: true
    type: string
definitions:
  CollectionListActivityResponse:
    type: object
    properties:
      kind:
        type: string
        description: Identifier used by Alvaria&trade; Cloud components to serialize the payload of the results
        example: 'via#listActivity'
      contactList:
        type: string
        description: Name of a contact list. This is used to get records associated with the specified contact list name.
        example: ContactList1
      recordsAvailable:
        type: integer
        description: Records available to dial for the dynamic list
        example: 100
      recordsAttempted:
        type: integer
        description: Records that were dialed at least once
        example: 100
      recordsInActive:
        type: integer
        description: Records that are with the dialer
        example: 100
      callsBusy:
        type: integer
        description: Records that must be re-attempted
        example: 25
      passcountPenetration:
        type: integer
        description: Percentage of records that have been dialed at least once for the dynamic lists
        example: 30
      passcountSaturation:
        type: integer
        description: Saturation is the number of contact attempts divided by the number of records attempted (as a percentage) for the dynamic lists
        example: 70
      listPenetration:
        type: integer
        description: Percentage of records that have been dialed at least once for the static list
        example: 70
      listSaturation:
        type: integer
        description: Saturation is the number of contact attempts divided by the number of records attempted (as a percentage) for the static list
        example: 40
  teamActivity:
    type: object
    properties:
      kind:
        type: string
        description: Identifier used by Alvaria&trade; Cloud components to serialize the payload of the results
        example: 'via#queryDataList'
      totalItems:
        type: integer
        description: The total number of rows of data in the return response.
        example: 2
      rows:
        type: array
        items:
          $ref: '#/definitions/teamActivityRows'
  teamActivityRows:
    properties:
      teamId:
        type: string
        description: 'Alvaria&trade; generated unique identifier for the team instance. The ID can be determined through the GET /via/v2/organizations/{orgId}/provisioning/teams endpoint.'
        example: salesTeam
      teamName:
        type: string
        description: A user friendly name of the Team.
        example: Sales Team
      notReadyCount:
        type: integer
        description: Number of users that are currently in the ’not ready’ state.
        example: 0
      parkCount:
        type: integer
        description: Number of users that are currently in the ‘park’ state.
        example: 0
      parkWarningCount:
        type: integer
        description: Number of users that are currently in the ‘park warning’ state.
        example: 0
      idleCount:
        type: integer
        description: Number of users that are currently in the ‘idle’ state.
        example: 1
      pendingActiveCount:
        type: integer
        description: Number of users that are currently in the ‘pendingActive’ state.
        example: 0
      activeCount:
        type: integer
        description: Number of users that are currently in the ‘active’ state and are handling an interaction.
        example: 0
      wrapCount:
        type: integer
        description: Number of users that are currently in the ‘wrap’ state.
        example: 0
      wrapWarningCount:
        type: integer
        description: Number of users that are currently in the ‘wrapwarning’ state.
        example: 0
      multiLineCount:
        type: integer
        description: Number of users that are currently handling more than one interaction.
        example: 0
      holdCount:
        type: integer
        description: Number of users that are currently in the 'hold' state.
        example: 0
      previewCount:
        type: integer
        description: Number of users that are currently in the 'preview' state.
        example: 0
  userActivity:
    type: object
    properties:
      kind:
        type: string
        description: Identifier used by Alvaria&trade; Cloud components to serialize the payload of the results
        example: 'via#queryDataList'
      totalItems:
        type: integer
        description: The total number of rows of data in the return response.
        example: 2
      rows:
        type: array
        items:
          $ref: '#/definitions/userActivityRow'
  userActivityRow:
    properties:
      userId:
        type: string
        description: 'Alvaria&trade; generated unique identifier for the user instance. The ID can be determined through the GET /via/v2/organizations/{orgId}/provisioning/users endpoint.'
        example: Keran123
      teamId:
        type: string
        description: 'Alvaria&trade; generated unique identifier for the team instance. The ID can be determined through the GET /via/v2/organizations/{orgId}/provisioning/teams endpoint.'
        example: salseTeam
      preferredName:
        type: string
        description: The name of the user in the following format 'FirstName LastName'.
        example: Keran Bloggs
      teamName:
        type: string
        description: A user friendly name of the Team.
        example: Sales team
      signOnTime:
        type: string
        format: date-time
        description: 'Date and time the user signed on, in UTC, specified in the ISO 8601 format (yyyy-MM-ddTHH:mm:ssZ).'
        example: '2018-02-07T11:29:46Z'
      stateId:
        type: string
        description: An Alvaria&trade; internal identifier for the current state that the user is in. This value may change in future versions.  This value may change in future versions so do not store persistently.
        example: active
        enum:
          - uninitialized
          - active
          - exception
          - held
          - idle
          - loggedoff
          - loggedon
          - multiline
          - notready
          - park
          - parkwarning
          - pendingactive
          - preview
          - reserved
          - wrap
          - wrapwarning
          - usercleared
      stateName:
        type: string
        description: A user friendly static name for the current state that the user is in.  This value may change in future versions so do not store persistently.
        example: Active
        enum:
          - Uninitialized
          - Active
          - Exception
          - Held
          - Idle
          - Logged Off
          - Logged On
          - Multiline
          - Not Ready
          - Park
          - Park Warning
          - Pending Active
          - Preview
          - Reserved
          - Wrap
          - Wrap Warning
          - User Cleared
      stateStartTime:
        type: string
        format: date-time
        description: 'Date and time that the last change in state occurred, in UTC time, specified in the ISO-8601 format (yyyy-MM-ddTHH:mm:ssZ).If the user is handling multiple interactions, this field will reflect the date and time that the last state change event was received.'
        example: '2018-02-07T11:29:46Z'
      reasonId:
        type: string
        description: 'The reason code identifier for the reason that the user is in a particular state. Reason codes are supported for the ''notready'', ''park'' and ''loggedout'' states. This value may change in future versions so do not store persistently.'
        example: break
      reasonName:
        type: string
        description: A user friendly name for the reason that the user is in a particular state.
        example: ''
      interactionCount:
        type: integer
        description: The number of interactions the user is currently handling.
        example: 1
      signOnTimeLocal:
        type: string
        format: date-time
        description: 'Date and time that the the user signed on, with the offset that was specified in tzOffset applied, specified in the ISO-8601 format (yyyy-MM-ddTHH:mm:ssTZD).'
        example: '2018-02-07T11:29:46-07:00'
      stateStartTimeLocal:
        type: string
        format: date-time
        description: 'Date and time that the last change in state occurred, with the offset that was specified in tzOffset applied, specified in the ISO-8601 format (yyyy-MM-ddTHH:mm:ssTZD). If the user is handling multiple interactions, this field will reflect the date and time that the last state change event was received.'
        example: '2018-02-07T11:29:46-07:00'
      stateDur:
        type: integer
        description: Duration in seconds that the interaction has been in the current state.
        example: 5
      signOnDur:
        type: integer
        description: Duration in seconds since the user signed on into Alvaria&trade; Cloud
        example: 664
  channelActivity:
    type: object
    properties:
      kind:
        type: string
        description: Identifier used by Alvaria&trade; Cloud components to serialize the payload of the results
        example: 'via#queryDataList'
      totalItems:
        type: integer
        description: The total number of rows of data in the return response.
        example: 2
      rows:
        type: array
        items:
          $ref: '#/definitions/channelActivityRow'
  channelActivityRow:
    properties:
      interactionTypeId:
        type: string
        description: An Alvaria&trade; internal identifier for the interaction type that interactions are associated with. This value may change in future versions.
        example: InboundEmail
        enum:
          - inboundacd
          - inbounddid
          - inboundconsultation
          - inboundinternal
          - inboundivr
          - outboundaod
          - outboundconsultation
          - outboundconsultationtransfer
          - outboundmakecall
          - conference
          - inboundipniq
          - inboundworkflow
          - inboundchat
          - inboundim
          - inboundemail
          - inboundcti
          - inboundsms
          - manualoutboundemail
      channelTypeId:
        type: string
        description: An Alvaria&trade; internal identifier for the channel (media) type that interactions are associated with. This value may change in future versions.
        example: email
        enum:
          - chat
          - email
          - sms
          - voice
      workTypeId:
        type: string
        description: An Alvaria&trade; internal identifier for the worktype entity instance.  This value may change in future versions.
        example: worktype30_id
      interactionTypeName:
        type: string
        description: A static predefined user friendly name for the interaction type.
        example: Inbound Email
        enum:
          - Inbound Acd
          - Inbound Did
          - Inbound Consultation
          - Inbound Internal
          - Inbound Ivr
          - Outbound Aod
          - Outbound Consultation
          - Outbound Consultation Transfer
          - Outbound Makecall
          - Conference
          - Inbound Ipniq
          - Inbound Workflow
          - Inbound Chat
          - Inbound IM
          - Inbound Email
          - Inbound CTI
          - Inbound SMS
          - Manual Outbound Email
      channelTypeName:
        type: string
        description: A static predefined name for the channel type.  This value may change in future versions so do not store persistently.
        example: Email
        enum:
          - Chat
          - Email
          - Sms
          - Voice
      workTypeName:
        type: string
        description: 'A user friendly name for the worktype. '
        example: workType30
      dialCount:
        type: integer
        description: Number of interactions associated with this worktype that are currently dialing.
        example: 0
      activeCount:
        type: integer
        description: Number of interactions associated with this worktype that are currently active.
        example: 0
      queueCount:
        type: integer
        description: 'Number of interactions associated with this worktype that are currently queued. '
        example: 0
      selfServiceCount:
        type: integer
        description: 'Number of interactions associated with this worktype that are currently in the self service subsystem. '
        example: 0
      previewCount:
        type: integer
        description: Number of users that are currently previewing information before initiating a call to the customer
        example: 0
      holdCount:
        type: integer
        description: Number of interactions associated with this worktype that are currently on hold.
        example: 0
      inactiveCount:
        type: integer
        description: Number of interactions associated with this worktype that are currently inactive.
        example: 0
      wrapCount:
        type: integer
        description: Number of interactions associated with this worktype that are currently in wrap.
        example: 0
      ringCount:
        type: integer
        description: Number of interactions being offered to an user/ringing
        example: 0
      longestWaitingQueueTime:
        type: string
        format: date-time
        description: 'Date and time of the interaction with the longest queue time (currently), of all the interactions in the queue, in UTC and specified in ISO 8601 format (yyyy-MM-ddTHH:mm:ssZ)'
        example: '2018-02-07T11:29:46Z'
      selfServiceDur:
        type: integer
        description: Duration in seconds that denotes the total duration of all the interactions currently in self service.
        example: 5
      queueDur:
        type: integer
        description: Duration in seconds that denotes the total duration of all the interactions currently in queue.
        example: 5
      activeDur:
        type: integer
        description: Duration in seconds that denotes the total duration of all the interactions currently active.
        example: 0
      previewDur:
        type: integer
        description: Duration in seconds that denotes the total duration of all the interactions currently in preview.
        example: 0
      maxQueueDur:
        type: integer
        description: 'The interaction with the longest queue time (currently), of all the interactions in the queue.'
        example: 0
  ErrorResponse:
    type: object
    properties:
      error:
        type: string
        example: Bad Request
        items:
          $ref: '#/definitions/ErrorResponseObj'
  ErrorResponseObj:
    properties:
      code:
        type: integer
        description: Error code
        example: 404
      message:
        type: string
        description: Error message
        example: Not Found
      errors:
        type: array
        example: errors
        items:
          $ref: '#/definitions/ErrorResponseItem'
  ErrorResponseItem:
    properties:
      scope:
        type: string
        description: Scope of the error
        example: scope
      reason:
        type: string
        description: Reason for the error
        example: reason
      message:
        type: string
        description: Error message
        example: message
  UsersCollection:
    type: object
    required:
      - kind
      - totalItems
      - users
    properties:
      kind:
        description: Identifier used by Alvaria&trade; Cloud components to serialize the payload of the results.
        type: string
        default: 'via#presenceDataList'
        example: 'via#presenceDataList'
      users:
        type: array
        items:
          $ref: '#/definitions/userRow'
      totalItems:
        type: integer
        description: The total number of Entity instances existing in the system.
        example: 1
  userRow:
    title: userRow
    required:
      - userId
      - firstName
      - lastName
      - ehubSessionId
    type: object
    properties:
      userId:
        description: Alvaria&trade; generated unique identifier for the user instance.
        type: string
        example: Keran123
      firstName:
        description: First name of the user instance from the user’s My Account profile.
        type: string
        example: Mahesh
      lastName:
        description: Last name of the user instance from the user’s My Account profile.
        type: string
        example: Kumar
      ehubSessionId:
        description: Alvaria&trade; generated unique identifier for the session with the Alvaria&trade; Cloud system.
        type: string
        example: 2323
      emailAddress:
        description: Email address of the user instance from the user’s My Account profile.
        type: string
        example: agent@alvaria.com

