Customer Records Retriever
Introduction:
This document describes how to retrieve completed session data from Glance, making a series of HTTP requests and interpreting the responses.
How to retrieve completed sessions:
-
Make an HTTP POST to the following REST endpoint:
https://cloud.glance.net/api/auth/service
, with the following characteristics.-
Content-Type
header is set toapplication/json
. - Request body is set to a JSON string that looks like the following, with user credentials procured through your Glance Networks representative:
{ "username": "<USERNAME>", "password": "<PASSWORD>" }
-
-
The response from the above call will look like the following, where the long
access_token
value is a JWT to be used in further HTTP calls:{ "access_token": "eyJhbGciOi..." }
-
Make an HTTP POST call to the following REST endpoint:
https://cloud.glance.net/api/crr/sessions/completed
with the following characteristics:-
Content-Type
header is set toapplication/json
. -
Authorization
header is set toBearer <token>
, where<token>
is the JWT returned from the Authentication Service in step 2 above. - Request body is set to a JSON string that looks like the following:
{ "partnerId": 12345, "apiKey": "<REDACTED>", "startDate": "2023-08-12T00:00:00Z", "endDate": "2023-08-15T00:00:00Z" }
-
-
The requested session data records will look like the following:
a. Code 200 - on success:
{ "sessions": [ { "id": "111111111", "key": "5555", "status": "ended", "started_at": "2023-08-14T17:36:06.000Z", "ended_at": "2023-08-14T17:38:23.000Z", "extra": { "xid": "1234123412342134" }, "channels": [ { "type": "cobrowse", "id": "111111111", "key": "5555", "legs": [ { "type": "host", "participant_type": "visitor", "started_at": "2023-08-14T17:36:02.000Z", "ended_at": "2023-08-14T17:38:22.000Z", "extra": { "name": "Guy Example", "email": "guy@example.com", "phone": "555-123-4567", } }, { "type": "viewer", "participant_type": "agent", "participant_id": "77777777", "participant_role": "AgentRole1", "origin": "AGENTAPP/1.2.3", "started_at": "2023-08-14T17:36:06.000Z", "ended_at": "2023-08-14T17:38:22.000Z", } ] }, { "type": "video", "id": "222222222", "key": "5555V999999", "legs": [ { "type": "host", "participant_type": "visitor", "started_at": "2023-08-14T17:36:46.000Z", "ended_at": "2023-08-14T17:38:22.000Z", "extra": { "name": "Guy Example", "email": "guy@example.com", "phone": "555-123-4567", } }, { "type": "viewer", "participant_type": "agent", "participant_id": "77777777", "participant_role": "AgentRole1", "started_at": "2023-08-14T17:36:48.000Z", "ended_at": "2023-08-14T17:38:23.000Z", } ] }, { "type": "video", "id": "333333333", "key": "5555V777777", "legs": [ { "type": "host", "participant_type": "agent", "participant_id": "77777777", "participant_role": "AgentRole1", "started_at": "2023-08-14T17:36:47.000Z", "ended_at": "2023-08-14T17:38:22.000Z", }, { "type": "viewer", "participant_type": "visitor", "started_at": "2023-08-14T17:36:49.000Z", "ended_at": "2023-08-14T17:38:23.000Z", "extra": { "name": "Guy Example", "email": "guy@example.com", "phone": "555-123-4567", } } ] }, { "type": "screenshare", "id": "444444444", "key": "5555S888888", "legs": [ { "type": "host", "participant_type": "agent", "participant_id": "77777777", "participant_role": "AgentRole1", "started_at": "2023-08-14T17:37:18.000Z", "ended_at": "2023-08-14T17:38:22.000Z", }, { "type": "viewer", "participant_type": "visitor", "started_at": "2023-08-14T17:37:19.000Z", "ended_at": "2023-08-14T17:38:22.000Z", "extra": { "name": "Guy Example", "email": "guy@example.com", "phone": "555-123-4567", } } ] } ] } ] }
b. Code 400 - badly formed request, with reason given:
{ "status": 400, "message": "Unknown environment" }
c. Code 401 - bad JWT:
{ "status": 401, "message": "Unauthorized" }
d. Code 422 - semantically bad request, with reason given:
{ "status": 422, "message": "Bad startDate value - not a valid date string" }
e. Code 429 - request rate limit exceeded:
{ "status": 429, "message": "Too Many Requests" }
f. Code 500 - unspecified internal error, or incorrect API Key specified in JSON payload:
{ "status": 500, "message": "Internal Server Error" }
Session Data Description:
The following is a description of the data returned in step 4 above, on success.
-
Each session in
sessions
has the following properties:-
id
: A unique identifier for the session. -
key
: The code/key a participant would use to interact with the session. -
status
: An enumerated field which can have one of the following values: -
ended
-
started_at
: A timestamp in RFC 3339 format (with zeroed-out milliseconds) denoting the time the session started, to second accuracy. -
ended_at
: A timestamp in RFC 3339 format (with zeroed-out milliseconds) denoting the time the session ended, to second accuracy. -
channels
: A list of JSON objects representing the channels used during the session (see below). A channel can be thought of as a stream of communication (e.g., cobrowse, video, screenshare) with a single active host/broadcaster and typically one or more passive viewers. There may be more than one channel per channel type in a given session. -
extra
: A JSON object of arbitrary properties set by the customer through a Glance client. Here are some common properties used: -
xid
: An external ID for matching the session with the session record in another system used by the customer.
-
-
Each channel within a session has the following properties:
-
type
: An enumerated field which can have one of the following values: -
cobrowse
-
video
-
screenshare
-
id
: A unique identifier for the channel. The "main" channel of a session will have the same value as the sessionid
. -
key
: The code/key a participant would use to interact with the session. The "main" channel of a session will have the same value as the sessionkey
. -
legs
: A list of JSON objects, each representing a span of time when a participant had been the channel (see below).
-
-
Each leg within a channel has the following properties:
-
type
: The type of leg, which can have one of the following values: -
host
: The participant hosted the channel. -
viewer
: The participant was a passive viewer of the host's data on the channel. -
participant_type
: An enumerated field which can have one of the following values: -
agent
: A customer agent. -
visitor
: A site visitor. -
guest
: A guest of the session. -
participant_id
: Ifparticipant_type
isagent
, this may contain the partner user ID of the agent. Only the main channel is guaranteed to have a leg with this set, and it is set for the agent who initiated the session with the visitor. For non-agent participants, this field will not be set. -
participant_role
: Ifparticipant_type
isagent
, this may contain the name of the role of the agent, signifying a set of permissions. For non-agent participants, this field will not be set. -
origin
: Ifparticipant_type
isagent
, this may contain the application used by the agent to join the channel. Can benull
or missing if unrecorded. For non-agent participants, this field will not be set. -
started_at
: A timestamp in RFC 3339 format (with zeroed-out milliseconds) denoting the time the participant joined the channel, to second accuracy. -
ended_at
: A timestamp in RFC 3339 format (with zeroed-out milliseconds) denoting the time the participant left the channel, to second accuracy. -
extra
: A JSON object of arbitrary properties set by the customer through a Glance client. Here are some common properties used:-
name
: The participant's name. -
email
: The participant's email address. -
phone
: The participant's phone number.
-
-
Assumptions:
- The date range between
startDate
andendDate
in step 3.c must not be 31 days or longer. - The
apiKey
value used in step 3.c is the same as the secret key used to access data from other endpoints on theglance.net
Web Server. Please request this from your Glance Networks representative.
Rate Limiting:
The endpoint in step 3 above is configured to only allow two requests per second for any given partnerId
specified in the body. Making requests more frequently than that, over a period of time, will result in a 429 response.