REST Sample Requests
REST API
This is a quick run down on things you can try in browser directly via the REST interface. Results are returned in JSON format.
Realtime
To see realtime snapshot/information for queue stats and agent stats:
http://server/stats/rest/index.php?entity=realtime
To see the same realtime information but limited to one or more queues instead of all:
http://server/stats/rest/index.php?entity=realtime&queues=100,101
Available Queues
To retrieve the list of queues available on the system/reports:
http://server/stats/rest/index.php?entity=queues
To see a particular queue you can filter out by id:
http://server/stats/rest/index.php?entity=queues/1
Available Agents
To see the list of available Agents on the system/reports:
http://server/stats/rest/index.php?entity=agents
You can select only one particular agent by id:
http://server/stats/rest/index.php?entity=agents/1
Call Flow
It is possible to retrieve all events concerning one particular call by knowing the call uniqueid:
http://server/stats/rest/index.php?entity=call/1429548401.6096
Search
It is possible to search for calls.
Since Asternic 2.2.0, you can narrow down results by:
- start = start date
- end = end date
- agent = agent
- queue = queue
- uniqueid = uniqueid
- clid = caller id number
- url = url field
- tag = tag field
- did = did field
- talktime = talk duration, range format like 10,50
- waittime = wait duration, range format like 30,60
So, if you want to search for a call with callerid 4126412320 on January 1st 2015, that lasted for more than 60 seconds, you can use this:
http://server/stats/rest/index.php?entity=search&clid=4126412320&start=2015-01-01&end=2015-01-01&talktime=60,99999
For Asternic previous to version 2.2.0
You can narrow down results by filtering by:
- start = start date
- end = end date
- clid = caller id number
- secondsstart = start second on the day ( minimum value 0 )
- secondsend = end seconds for the day ( maximum value 86400 )
- agent = agent
- queue = queue
- duration = duration in seconds
- dur_condition = condition comparison for duration , like > or < or =
So, if you want to search for a call with callerid 4126412320 on January 1st 2015, that lasted for more than 60 seconds, you can use this:
http://server/stats/rest/index.php?entity=search&clid=4126412320&start=2015-01-01&end=2015-01-01&duration=60&dur_condition=>
Available Reports
To see a list of available reports:
http://server/stats/rest/index.php?entity=reports
To run a particular report and get the data:
http://server/stats/rest/index.php?entity=reports/answered_calls_detail&start=2016-01-01&end=2016-01-31
- start = start date
- end = end date
- secondsstart = start second on the day ( minimum value 0 )
- secondsend = end seconds for the day ( maximum value 86400 )