<main>
<article class="userContent">
<p>This page gives an example to fetch agent times from REST API. There are two ways to fetch times of the agent.</p><ul><li>List</li><li>Aggregation</li></ul><h2 data-id="list-of-agent-onlineloggedin-times">List of agent online/loggedin times</h2><p>This API call returns a list of the online times of the agent. <a href="https://developers.chatvisor.com/#operation/getAgentLoggedInTimesUsingPOST" rel="nofollow noreferrer ugc">https://developers.chatvisor.com/#operation/getAgentLoggedInTimesUsingPOST</a></p><p>Request</p><p>Response</p><pre class="code codeBlock" spellcheck="false" tabindex="0">POST https://api.chatvisor.com/rest/v1/report/agent/times/online?access_token=<TOKEN>
BODY:
{
"grouping": "LAST_7_DAYS"
}
</pre><h2 data-id="aggregation-of-agent-onlineloggedin-times">Aggregation of agent online/loggedin times</h2><p>This API call returns a aggregated statistic of the agent times in seconds. <a href="https://developers.chatvisor.com/#operation/getUsingPOST" rel="nofollow noreferrer ugc">https://developers.chatvisor.com/#operation/getUsingPOST</a></p><p>Request</p><p>Response</p><pre class="code codeBlock" spellcheck="false" tabindex="0">POST https://api.chatvisor.com/rest/v1/report/agent?access_token=<TOKEN>
BODY:
{
"metrics": [
{
"metricName": "ONLINE_TIME", # or LOGGED_IN_TIME
"groupBy": "AGENT" # optional group by agent
}
],
"dateFilter": {
"grouping": "LAST_7_DAYS"
}
}
</pre><p><br></p>
</article>
</main>