How to run reports from CCAWebAPI
Here are a few steps you need to follow to be able to run reports from CCAWebAPI . . .
1/ Get the list of reports and Ids:
GET: http://[WebServer]/CcaWebAPI/Reports
Extract:
{
"CcaObjectTypesUsedInParameters": [
7
],
"Revision": 0,
"Type": 0,
"CcaObjectType": 30,
"DateCreated": "2018-02-23T10:07:55.999",
"DateModified": "2018-02-23T10:07:55.999",
"Description": "Standard Report (v2)",
"Id": 2,
"Name": "Agent Outbound Calls (v2)"
},
2/ Get a list of the parameters for a specific report (here the "Agent Outbound calls (v2)" with ID=2):
{
"Request": {
"Method": "GET",
"Url": "http://[WebServer]/CcaWebAPI/Reports/2/parameters"
},
"Version": "5.4.9.6",
"StatusCode": 200,
"Response": [
{
"AllowBlank": false,
"DataType": 31,
"DefaultValues": null,
"Hidden": false,
"MultiValue": true,
"Name": "Filter1",
"Nullable": false,
"Prompt": "Task?"
},
{
"AllowBlank": false,
"DataType": 4,
"DefaultValues": null,
"Hidden": false,
"MultiValue": false,
"Name": "Filter3",
"Nullable": false,
"Prompt": "Time interval?"
}
]
}
3/ Run the report: E.g. outbound calls on survey id 1371 from 03 SEP 2019 00h00 until 17 SEP 2019 23h59 and get the result in a PDF file.
POST: http://[WebServer]/CcaWebAPI/Reports/2/Run?output=1
Header:
Add the Content-Type = application/json . . .
Body:
{
"Filter1": "1361","Filter3": "2019-09-03T00:00:00;2019-09-17T23:59:59"
}
Output:
Output | Name |
0 | RPT |
1 | |
2 | XLS |
3 | DOC |
4 | RAW |
5 | RTF |
6 | RTF_edit |
7 | XLS_data |
8 | XLS_data_minimal |
9 | CSV |
10 | TSV |
11 | HTML32 |
12 | HTML40 |
13 | XML |
14 | TXT |
You will get an answer from the API with a QID:
{
"Request": {
"Method": "POST",
"Url": "http://[WebServer]/CcaWebAPI/Reports/2/Run?output=1"
},
"Version": "5.4.9.6",
"StatusCode": 200,
"Response": {
"qid": 193
}
}
4/ Then download your file with the QID received:
http://[webserver]/CcaWebAPI/Reports/Requests/193/download