Agent Activity and Schedules

API Specification

Description Creates a task for workmanager to execute exportEngine  for Agent Activity and Schedules exporter.
Authentication
Required
Yes
URL https://<domain or IP>/SMARTSync/services/rs/exporters/v1/agent-activity-and-schedules
Method POST
Request Headers

Cookie: JSESSIONID={jsessionId}

Content-Type: application/json

Request Params (See below)

API Specification: Request Params

startDate - String, format:  YYYY-MM-YY

Required: true.

Notes: cannot be after the endDate.

endDate - String, format:  YYYY-MM-YY

Required: true.

Notes: cannot be before the startDate.

outputFormat - String, supported formats: PIPE, JSON

Required: true.

Notes: is not case sensitive

dateFormat - String, possible values: mmddyy, ddmmyy, mmddyyyy, ddmmyyyy, yyyymmdd, yyyyddmm, yyddmm, yymmdd.

If dateformat is not provided and outputFormat is set to JSON, all date fields will be converted into ISO date format.

Required: only for PIPE outputFormat.

Notes: is not case sensitive. Determines format of output dates.

timeFormat - String, possible values: 12, 24. 

Determines format of output times.

Required: true.

Notes: is not case sensitive.

muIds - Array of integers.

Should be one or more IDs user has permission to use.

Required: true.

Notes: is not case sensitive. 

keepEmptyJsonFields - Boolean field.

Required: false.

Notes: This field can be set only if outputFormat is set to JSON. By default it is false. If it is set to true, the JSON output will contain empty values ({},[],"") for fields.

excludePipeHeader Boolean field.

Required: false.

Notes: This field can be set only if outputFormat is PIPE. By default it is false. If it is set to true, headers will be excluded from PIPE output.

fields - array of objects. Represents the list of the supported field names, fields with attribute values, and fields with specified value. All field names, attributes and values are not case sensitive. 

Required: false.

Possible values:

Simple fields when outputFormat is PIPE

{"name":"date"}, {"name":"TZ"}, {"name":"custID"}, {"name":"muID"}, {"name":"tvID"}, {"name":"acdID"}, {"name":"logonID"}, {"name":"ssn"}, {"name":"agentName"}, {"name":"modify"}, {"name":"activityStart"}, {"name":"activityEnd"}, {"name":"activityDuration"}, {"name":"activityInOffice"}, {"name":"activityBusiness"}, {"name":"activityAvail"}, {"name":"activityOpen"}, {"name":"activityOT"}, {"name":"activityPaid"}, {"name":"activityWeeklyHours"}, {"name":"schedStart"}, {"name":"schedEnd"}, {"name":"schedDuration"}, {"name":"schedInOffice"}, {"name":"schedBusiness"}, {"name":"schedAvail"}, {"name":"schedOpen"}, {"name":"schedOT"}, {"name":"schedPaid"}, {"name":"schedWeeklyHours"}, {"name":"startDev"}, {"name":"endDev"}, {"name":"durationDev"}, {"name":"externalID"}, {"name":"schedOpenStart"}

Simple fields when outputFormat is JSON

{"name":"date"}, {"name":"TZ"}, {"name":"custID"}, {"name":"muID"}, {"name":"tvID"}, {"name":"acdID"}, {"name":"logonID"}, {"name":"personalID"}, {"name":"agentName"}, {"name":"modify"}, {"name":"activityStart"}, {"name":"activityEnd"}, {"name":"activityDuration"}, {"name":"activityInOffice"}, {"name":"activityBusiness"}, {"name":"activityAvail"}, {"name":"activityOpen"}, {"name":"activityOT"}, {"name":"activityPaid"}, {"name":"activityWeeklyHours"}, {"name":"schedStart"}, {"name":"schedEnd"}, {"name":"schedDuration"}, {"name":"schedInOffice"}, {"name":"schedBusiness"}, {"name":"schedAvail"}, {"name":"schedOpen"}, {"name":"schedOT"}, {"name":"schedPaid"}, {"name":"schedWeeklyHours"}, {"name":"startDev"}, {"name":"endDev"}, {"name":"durationDev"}, {"name":"externalID"}, {"name":"schedOpenStart"}

Note: 

  • In the fields array parameter, the output field ssn may be used for PIPE output.
  • For JSON output, ssn must be replaced with personalID.
  • Only one field with the same name can be present in the fields array.

Field with multi value:

{"name":"agentData","value":"value1"}, {"name":"agentData","value":"value2"}

Note: agentData value should exist in DB.

sortOrder - Array of objects.

Represents the list of the supported field names, fields with attribute values, and fields with specified value. All field names, attributes and values are not case sensitive. 

Required: false.

Possible values: the same values as for fields.

API Specification (cont)

Response
Data

Response has an unique JobId:

jobId is a 32 length string.

Example

{
   "jobId":"9b2fe7bb8362429fb85a16c9373cf50c"
}
Response
Headers
Content-Type: application/json
Success
Response
Code: 200 OK
Content : [Response Data]
Error
Response

Code: 401 Unauthorized

Error message:

{
"message":"Unauthorized",
"status":401
}
Code: 400 Bad Request
All fields are invalid:
{
"message": "One or more request validations failed",
"status": 400,
"details": [
"Invalid field: 'keepEmptyJsonFields'",
"Invalid field: 'excludePipeHeader'",
"Invalid outputFormat value: 'XML'",
"Invalid dateFormat value: 'ddmmcyyyy'",
"Invalid timeFormat value: '1c2'",
"startDate must match the provided yyyy-MM-dd format",
"endDate must match the provided yyyy-MM-dd format",
"Insufficient permissions to view entities 'MU -1'",
        "Invalid entity: 'MU 1234567'",
"Invalid attribute value: 'wrongAttribute'",
"Invalid values within fields element: wrongField2,wrongField1"
    ]
}
Start date>end date
{
"message":"One or more request validations failed",
"status":400,
"details": [
"endDate must be either equal to or after the startDate"
    ]
}
Code: 500 Internal server error
Sample Call for PIPE outputFormat

https://localhost/SMARTSync/services/rs/exporters/v1/agent-activity-and-schedules

request body(request for all fields):


{
 "startDate":"2023-11-10",
 "endDate":"2024-11-10",
 "outputFormat":"pipe",
 "dateFormat":"ddmmyyyy",
 "timeFormat":"12",
 "muIds":[
   500
  ]
}


request body(request for specific fields):

{
 "startDate":"2022-11-10",
 "endDate":"2022-11-10",
 "outputFormat":"pipe",
 "dateFormat":"ddmmyyyy",
 "timeFormat":"12",
 "muIds":[
   500
  ],
 "fields":[{"name":"custID"}, {"name":"TZ"}],
 "sortOrder":[{"name":"custID"}, {"name":"TZ"}, {"name":"agentData","value":"TEST"}]
}


Sample Call for JSON outputFormat

https://localhost/SMARTSync/services/rs/exporters/v1/agent-activity-and-schedules

request body(request for all fields):


{
"startDate":"2023-11-10",
"endDate":"2024-11-10",
"outputFormat":"JSON",
"dateFormat":"ddmmyyyy",
"keepEmptyJsonFields":true,
"timeFormat":"12",
"muIds":[
500
  ]
}
request body(request for specific fields):
{
   "startDate":"2022-11-10",
   "endDate":"2022-11-10",
   "outputFormat":"JSON",
   "dateFormat":"ddmmyyyy",
   "timeFormat":"12",
   "keepEmptyJsonFields":true,
   "muIds": [
500
    ],
 "fields":[{"name":"custID"}, {"name":"TZ"}],
 "sortOrder":[{"name":"custID"}, {"name":"TZ"}, {"name":"agentData","value":"TEST"}]
}
}

 

Output Field Descriptions

  • This export runs for each MU specified in the muIds list.

  • If the export runs for multiple MUs, all the data is saved in the same output file.

  • For each date in the range specified, the Activity and Schedule data is read for each agent that belongs to the MU being processed for the date being processed.

  • Rather than using the schedule’s start date, the date on which an activity code occurs determines which date record includes the activity code. Therefore, this exporter reads schedules for the day before the specified start date, to include activity codes that cross midnight from the previous day into the start date. If an agent’s schedule crosses midnight into the day after the specified end date, the activity codes that fall on the day after the end date are excluded from the export.

  • Agent data group values assigned to the agent for the date being processed are exported. Agent data group values are stored by date range and are not dependent on the agent’s MU assignment.

The Agent Activity and Schedules output can contain these fields:

Field

Description

Values

date

The activity code date based on the MU’s time zone.

The activity code date may be different from the schedule date, if the schedule crosses midnight.

The format of the date is specified in the dateFormat parameter.

If no dateFormat is provided, then the format defaults to mmddyyyy if the outputFormat is PIPE. If the outputFormat is JSON, then dates default to ISO 8601 format. If the outputFormat is XML, the format is always a fixed XML structure.

Note: Only the activity code date is shown; the schedule date is omitted because the number of minutes an agent spent in an activity code for a day may have come from two different schedules, if the agent worked a cross-midnight schedule.

 

TZ

The MU’s time zone.

 

custID

The customer ID.

 

muID

The ID of the MU.

 

tvID

The agent’s WFM ID.

 

acdID

The ID of the agent’s highest-priority ACD for the associated schedule date. The highest-priority ACD is the one with the lowest priority number.

 

logonID

The agent’s highest-priority ACD or multimedia server logon ID for the associated schedule date. The highest-priority ACD is the one with the lowest priority number.

It is possible for this field to be blank.

ssn

The agent’s personal ID number.

For JSON output, personalId is used instead

This field is blank if no personal ID number is assigned to the agent.

agentData

This field contains the value assigned to the agent for an agent data group you wish to be exported

You can include as many agentData elements as you want; one field is printed in the output file for each agentData element defined in the Request Params.

It is also possible the same agent data group may be specified more than once.

If you do not include an agentData element, this field is omitted.

This field may be blank if the agent is not assigned a value for the specified agent data group for the date being processed.

agentName

The agent’s name, formatted as <last>, <first> <suffix>.

 

modify

The later of the schedule record’s and the activity record’s modify timestamps.

 

activityStart

The earliest time for which activity data exists for the agent on the date being exported.

If the agent’s schedule from the previous date crosses midnight into the date being processed, and the agent generates activity crossing midnight as well, midnight is shown in this field. This is due to agent activity being stored midnight-to-midnight in NICE WFM.

This time is shown in the MU’s time zone, and formatted according to the timeFormat. If no timeFormat attribute exists, 24-hour format is used.

 

activityEnd

The latest time for which activity data exists for the agent on the date being exported.

If the agent’s schedule crosses midnight into the following date, and the agent generates activity crossing midnight as well, midnight is shown in this field. This is due to agent activity being stored midnight-to-midnight in NICE WFM.

This is the clock time and therefore excludes the stop minute. For example, if 8 hours of activity exists, beginning at 10:00AM, this field shows 6:00PM, not 5:59PM.

This time is shown in the MU’s time zone, and formatted according to the specified timeFormat. If no timeFormat attribute exists, 24-hour format is used.

 

activityDuration

The total number of minutes of activity that exist for the agent on the date being exported.

 

activityInOffice

The total number of activity minutes that exist for the agent on the date being exported for activity codes designated as In Office.

 

activityBusiness

The total number of activity minutes that exist for the agent on the date being exported for activity codes designated as Business.

 

activityAvail

The total number of activity minutes that exist for the agent on the date being exported for activity codes designated as Available.

 

activityOpen

The total number of activity minutes that exist for the agent on the date being exported for activity codes designated as Open.

 

activityOT

The total number of activity minutes that exist for the agent on the date being exported for activity codes designated as OT.

 

activityPaid

The total number of activity minutes that exist for the agent on the date being exported for activity codes designated as Paid.

 

activityWeeklyHours

The total number of activity minutes that exist for the agent on the date being exported for activity codes designated as Weekly Hours.

 

schedStart

The start time of the agent’s schedule on the date being exported. If the agent works a split-shift, this is the earliest start time for the date.

If the agent’s schedule from the previous date crosses midnight into the date being processed, midnight is shown in this field.

This time is in the MU’s time zone, and formatted according to the specified timeFormat. If no timeFormat attribute exists, 24-hour format is used.

 

schedEnd

The end time of the agent’s schedule on the date being processed. If the agent works a split-shift, this is the latest end time for the date.

If the agent’s schedule crosses midnight into the following date, midnight is shown in this field.

This is the clock time and therefore excludes the stop minute. For example, if 8 hours of schedule exists, beginning at 10:00AM, this field shows 6:00PM, not 5:59PM.

This time is in the MU’s time zone, and formatted according to the specified timeFormat. If no timeFormat attribute exists, 24-hour format is used.

 

schedDuration

The total number of schedule minutes that exist for the agent for the date being processed.

 

schedInOffice

The total number of schedule minutes that exist for the agent on the date being exported for activity codes designated as In Office.

 

schedBusiness

The total number of schedule minutes that exist for the agent on the date being exported for activity codes designated as Business.

 

schedAvail

The total number of schedule minutes that exist for the agent on the date being exported for activity codes designated as Available.

 

schedOpen

The total number of schedule minutes that exist for the agent on the date being exported for activity codes designated as Open.

 

schedOT

The total number of schedule minutes that exist for the agent on the date being exported for activity codes designated as OT.

 

schedPaid

The total number of schedule minutes that exist for the agent on the date being exported for activity codes designated as Paid.

 

schedWeeklyHours

The total number of schedule minutes that exist for the agent on the date being exported for activity codes designated as Weekly Hours.

 

startDev

The number of minutes between the schedule start time and the activity start time.

This value is negative if the activity start time is earlier than the schedule start time, activity start - schedule start.

endDev

The number of minutes between the schedule end time and the activity end time.

This value is negative if the activity end time is earlier than the schedule end time, activity end - schedule end.

durationDev

The number of minutes between the activity duration and the schedule duration.

This value is negative if the activity duration is shorter than the schedule duration, activity duration - schedule duration.

externalID

The ID the agent uses to log in to the Agent WebStation if the WebStation is configured to use external IDs.

If the agent's externalID field is blank, this field is blank.

schedOpenStart

The start time of the agent’s first occurring code with an open attribute on the date being exported.

 

 

Supported output formats:

  • PIPE
  • JSON

JSON with results with ISO dates and non empty fields

JSON with results and non empty fields

JSON with results and empty fields

JSON with empty result

PIPE result with enabled headers

PIPE with disabled headers

PIPE result with empty data

Agent activity and schedules DTD