JSON API » analytics » analytics/create
Creates a new analytics report.
Input parameters
Requires authentication and the administrator privilege.
| Name | Type | Description | Required | Default value | 
|---|---|---|---|---|
| auth_username | String | Authentication username. | Yes | |
| auth_password | String | Authentication password. | Yes | |
| name | String | Report name. | Yes | |
| type | String | Report type, one of "table", "linechart", "barchart", "stacked", or "piechart". | Yes | None | 
| owner | Integer | ID number of owning user, or 0 for none. | No | 0 | 
| recursive | Integer | 1 to include sub-customers recursive, 0 not to. | No | 0 | 
| piesource | String | ID string of source for pie chart data, 0 for none. | No | Empty string | 
| period | Integer | 0 to report per destination. 60, 300, 900, 1800, 3600, 10800, 21600, 43200, 86400, 604800 to report in increments of that many seconds. -1800 to report on the half hour of the day, -3600 to report on the hour of the day, and -604800 to report on the day of the week. | No | 0 | 
| startday | Integer | -31, -30, etc through to -1 for that many days ago, 0 for today, 1 to use specific date as per "startdate", 2 for first day of last month, 3 for first day of this month, 4 for tomorrow. | No | 0 | 
| startdate | Integer | Start date as unix timestamp, does not include time of day. Only used if "startday" is 1. | No | 0 | 
| starttime | Integer | Start time as offset from midnight in seconds. Only used if "startday" is 1. | No | 0 | 
| endday | Integer | -31, -30, etc through to -1 for that many days ago, 0 for today, 1 to use specific date as per "startdate", 2 for first day of last month, 3 for first day of this month, 4 for tomorrow. | No | 0 | 
| enddate | Integer | End date as unix timestamp, does not include time of day. Only used if "endday" is 1. | No | 0 | 
| endtime | Integer | End time as offset from midnight in seconds. Only used if "endday" is 1. | No | 0 | 
| slatime | Integer | Maximum number of seconds that call must be answered within to be counted in the "SLA ok" metric. | No | 0 | 
| shorttime | Integer | Maximum number of seconds that call must be abandoned within to be counted as "short abandon", otherwise will be counted as "abandoned". | No | 0 | 
| phonetitle | String | How to display telephone names; "name" for full telephone line number, "description" for description, "internal" for internal callerid, "name_description" for number and description, "internal_description" for internal callerid and description, "description_name" for description and number, "description_internal" for description and internal callerid. | No | name | 
| scheduled | Integer | 0 to never email report, -1 to email on first day of month, 1 for Mondays, 2 for Tuesdays, 4 for Wednesdays, 8 for Thursdays, 16 for Fridays, 32 for Saturdays, 64 for Sundays, 127 for every day of the week. | No | 0 | 
| emailtime | Integer | Time of day to email report, as number of hours from midnight. | No | 0 | 
| String | Email address(es) to send report to, separated by spaces. | No | Empty string | |
| totalcalls | Integer | 1 to show the "Total calls" metric, 0 not to. | No | 0 | 
| answercalls | Integer | 1 to show the "Answered" metric, 0 not to. | No | 0 | 
| noanswercalls | Integer | 1 to show the "Not answered" metric, 0 not to. | No | 0 | 
| slaok | Integer | 1 to show the "SLA ok" metric, 0 not to. | No | 0 | 
| incalls | Integer | 1 to show the "Inbound calls" metric, 0 not to. | No | 0 | 
| inanswer | Integer | 1 to show the "Inbound answered" metric, 0 not to. | No | 0 | 
| innoanswer | Integer | 1 to show the "Inbound no answer" metric, 0 not to. | No | 0 | 
| internalcalls | Integer | 1 to show the "Internal calls" metric, 0 not to. | No | 0 | 
| internalanswer | Integer | 1 to show the "Internal answered" metric, 0 not to. | No | 0 | 
| internalnoanswer | Integer | 1 to show the "Internal no answer" metric, 0 not to. | No | 0 | 
| outcalls | Integer | 1 to show the "Outbound calls" metric, 0 not to. | No | 0 | 
| outanswer | Integer | 1 to show the "Outbound answered" metric, 0 not to. | No | 0 | 
| outnoanswer | Integer | 1 to show the "Outbound no answer" metric, 0 not to. | No | 0 | 
| holdmin | Integer | 1 to show the "Hold time minimum" metric, 0 not to. | No | 0 | 
| holdavg | Integer | 1 to show the "Hold time average" metric, 0 not to. | No | 0 | 
| holdmax | Integer | 1 to show the "Hold time maximum" metric, 0 not to. | No | 0 | 
| holdtotal | Integer | 1 to show the "Hold time total" metric, 0 not to. | No | 0 | 
| talkmin | Integer | 1 to show the "Talk time minimum" metric, 0 not to. | No | 0 | 
| talkavg | Integer | 1 to show the "Talk time average" metric, 0 not to. | No | 0 | 
| talkmax | Integer | 1 to show the "Talk time maximum" metric, 0 not to. | No | 0 | 
| talktotal | Integer | 1 to show the "Talk time total" metric, 0 not to. | No | 0 | 
| totalmin | Integer | 1 to show the "Total time minimum" metric, 0 not to. | No | 0 | 
| totalavg | Integer | 1 to show the "Total time average" metric, 0 not to. | No | 0 | 
| totalmax | Integer | 1 to show the "Total time maximum" metric, 0 not to. | No | 0 | 
| totaltotal | Integer | 1 to show the "Total time total" metric, 0 not to. | No | 0 | 
| abandon | Integer | 1 to show the "Abandoned by caller" metric (> short abandon time), 0 not to. | No | 0 | 
| shortabandon | Integer | 1 to show the "Short abandon by caller" metric (<= short abandon time), 0 not to. | No | 0 | 
| noagent | Integer | 1 to show the "No agents available" metric, 0 not to. | No | 0 | 
| timeout | Integer | 1 to show the "Time-out in queue" metric, 0 not to. | No | 0 | 
| keypress | Integer | 1 to show the "Key press by caller" metric, 0 not to. | No | 0 | 
| agent | Integer | 1 to show the "Agent completed" metric, 0 not to. | No | 0 | 
| caller | Integer | 1 to show the "Caller completed" metric, 0 not to. | No | 0 | 
| transfer | Integer | 1 to show the "Transfer by agent" metric, 0 not to. | No | 0 | 
| logintime | Integer | 1 to show the "Available time" metric, 0 not to. | No | 0 | 
| unavailable | Integer | 1 to show the "Unavailable time" metric, 0 not to. | No | 0 | 
| allcalls | Integer | 1 to show the "All calls" destination, 0 not to. | No | 0 | 
| inbound | Integer | 1 to show the "External callers" destination, 0 not to. | No | 0 | 
| internal | Integer | 1 to show the "Internal call legs" destination, 0 not to. | No | 0 | 
| outbound | Integer | 1 to show the "External destinations" destination, 0 not to. | No | 0 | 
| numbers | Integer | "all" to report on all numbers and feature codes, "use_control_panel" to report those with "Show in control panel" enabled, "use_include" to select individually, "none" for none. | No | 0 | 
| numbersinclude | Integer | The numbers or feature codes (as a multi-value parameter) to include if "numbers" is set to "use_include". | No | 0 | 
| queues | Integer | "all" to report on all queues, "use_control_panel" to report those with "Show in control panel" enabled, "use_include" to select individually, "none" for none. | No | 0 | 
| queuesinclude | Integer | The queue ID numbers (as a multi-value parameter) to include if "queues" is set to "use_include". | No | 0 | 
| agents | Integer | "all" to report on all queue destinations, "queues" to report destinations in the displayed queues, "queues_available" to report destinations in displayed queues which are available in the queue, "use_control_panel" to report those with "Show in control panel" enabled, "use_include" to select individually, "none" for none. | No | 0 | 
| agentsinclude | Integer | The queue destinations (as a multi-value parameter) to include if "agents" is set to "use_include". Each agent must be in the format dtype_dnumber, for example phone_1234567. | No | 0 | 
| phones | Integer | "all" to report on all telephone lines, "use_control_panel" to report those with "Show in control panel" enabled, "use_include" to select individually, "none" for none. | No | 0 | 
| phonesinclude | Integer | The telephone lines (as a multi-value parameter) to include if "phones" is set to "use_include". | No | 0 | 
| totalrow | Integer | 1 to show the "Total" destination, 0 not to. | No | 0 | 
Responses
| Code | Description | 
|---|---|
| 200 | Success. | 
| 201 | Input passed validation. Only returned if validation=1. | 
| 400 | Invalid input parameters specified. Check the key and message fields for more details. | 
| 401 | The authentication details provided are invalid. | 
| 402 | Your role does not allow this. | 
Data returned
The ID of the created report.
Example: With required parameters
http://enswitch.example.com/api/json/analytics/create/?auth_username=user;auth_password=password;server=example;name=Test;type=table{ "responses":[ { "code":"200", "key":"", "message":"OK" } ], "data":{ "id":123 } }
Change history
| Version | Changes | 
|---|---|
| 4.3 | Function added. | 
