Configure the Session History API in DRE
The Session History API returns post-session data and details about a session or set of sessions according to the configured filtering options.
URL for Session History API
https://api.swi-rc.com/integration/get_history_api.php
Input Parameters
Element | Format | Mandatory | Description |
---|---|---|---|
KEY
|
Varchar(64) | Yes | Your API key |
VARS
|
Varchar(512) | Yes | Variable specification. Check description below |
(FILTERS)
|
--- | No | Filtering options. Check description below |
Vars
This variable specifies the information that is returned by the function. Each parameter is separated by a space.
Element | Format | Description |
---|---|---|
COMPUTER_NAME
|
Varchar(50) | Customer's computer name |
COMPUTER_DOMAIN
|
Varchar(100) | The domain of the customer's computer |
COMPUTER_OS
|
Varchar(64) | Computer's operating system |
TECH_USERNAME
|
Varchar(100) | Technician's username (email address) |
TECH_NAME
|
Varchar(100) | Technician's name |
CUSTOMER_NAME
|
Varchar(200) | Customer's name |
CUSTOMER_EMAIL
|
Varchar(100) | Customer's email address |
CUSTOMER_NUMBER
|
Varchar(50) | Customer's identification number in your company |
PROBLEM_DESCRIPTION
|
Varchar(4000) | Description of the problem |
NOTES
|
Varchar(4000) | Technician's description of the issue |
HAS_VIDEOS
|
BOOLEAN(TRUE ,FALSE ) |
Returns TRUE if there are recorded videos |
DATE_START
|
|
Session's starting time |
DATE_END
|
|
Session's ending time |
CHAT_INFO
|
XML | XML data structure containing the chat transcript |
VIDEO_LINKS
|
XML | XML data structure containing video URLs |
OUTPUT_FORMAT
|
XML or JSON | XML OR JSON |
CUSTOM_FIELD_NAME
|
Varchar(32) | Name for custom field |
CUSTOM_FIELD_VALUE
|
Varchar(100) | Value for custom field |
Filters
This function supports a number of filters that allows the selection of a subset if sessions.
Element | Format | Description |
---|---|---|
FILTER_ID
|
INT | Filter results from a specific session ID |
FILTER_DATE_START_INI
|
|
Session’s starting time must be higher than this value |
FILTER_DATE_START_END
|
|
Session’s starting time must be lower than this value |
FILTER_CUSTOMER_NAME
|
Varchar(100) | Customer's name |
FILTER_CUSTOMER_EMAIL
|
Varchar(100) | Customer's email address |
FILTER_CUSTOMER_NUMBER
|
Varchar(50) | Customer's identification number in your company |
FILTER_COMPUTER_NAME
|
Varchar(100) | Customer's computer name |
FILTER_COMPUTER_DOMAIN
|
Varchar(100) | Customer's computer domain |
FILTER_TECH_USERNAME
|
Varchar(100) | Technician's username |
FILTER_START_METHOD
|
ALL , APPLET , AGENT |
Session started from Agent software running on customer’s PC or otherwise (e.g. session started from a pin number) |
FILTER_PROCESSED
|
ALL , ANSWERED , NOT_ANSWERED |
Session was answered by a technician or not |
FILTER_HAS_VIDEOS
|
BOOLEAN (TRUE , FALSE ) |
Empty value = All requests |
FILTER_CUSTOM_FIELD_NAME
|
Varchar(32) | Name for custom field filter |
FILTER_CUSTOM_FIELD_VALUE
|
Varchar(100) | Value for custom field filter |
Output
The function returns the following XML structure:
<?xml version="1.0" encoding="iso-8859-1"?> <return> <nrequests>...</requests> <requests> <request> <id>...</id> <customer_name>...</customer_name> <customer_email>...</customer_email> <customer_number>...</customer_number> <computer_name>...</computer_name> <problem_description>...</problem_description> <notes>...</notes> <computer_os>...</computer_os> <has_videos></has_videos> <date_start>...</date_start> <date_end>...</date_end> <duration>...</duration> <tech_name>...</tech_name> <tech_username>...</tech_username> <chat> <nchatlines>...</nchatlines> <chatlines> <chatline> <from>...</from> <to>...</to> <dt></dt> <txt></txt> </chatline> <chatline> <from>...</from> <to>...</to> <dt></dt> <txt></txt> </chatline> </chatlines> </chat> <videos> <nvideos>1</nvideos> <video_links> <video> <size>..</size> <view_url>...</view_url> <download_url></download_url> </video> </video_links> </videos> </request>
Error Handling
The error messages are returned by the function within the XML structure in the following format:
<response><error_msg> Error message.</error_msg></response>
These are some other examples:
<response><error_msg>Invalid FILTER_HAS_VIDEOS setting.</error_msg></response>
<response><error_msg>Invalid FILTER_START_METHOD setting.</error_msg></response>
<response><error_msg>Invalid FILTER_DATE_START_INI value.</error_msg></response>
<response><error_msg>Invalid FILTER_DATE_START_END value.</error_msg></response>
Examples
This example returns the fields selected in VARS
from all the ANSWERED
sessions created after 2011-01-01
UTC:
get_session_history.php?KEY=xxxxx&VARS=ID CUSTOMER_NUMBER DATE_START DATE_END TECH_USERNAME&FILTER_DATE_START_INI=2011-01-01&FILTER_PROCESSED=ANSWERED
This example returns the fields selected in VARS
from all the ANSWERED
by tech mytech@techplace.com
requests created after 2011-01-01
UTC:
get_session_history.php?KEY=xxxxx&VARS=ID CUSTOMER_NUMBER DATE_START&FILTER_DATE_START_INI=2011-01-01& FILTER_PROCESSED=ANSWERED&FILTER_TECH_USERNAME=mytech@techplace.com
This example returns the fields selected in VARS
from request ID 12334
:
get_session_history.php?KEY=xxxxx&VARS=CUSTOMER_NAME CUSTOMER_NUMBER COMPUTER_NAME COMPUTER_DOMAIN PROBLEM_DESCRIPTION TECH_USERNAME DATE_START DATE_END HAS_VIDEOS COMPUTER_OS NOTES&FILTER_ID=12334