Reporting APIs
Reporting queries can be used to fetch data from report groups, for all reports under a specific group, or for a specific report.
Synopsis |
|
|
Supported Resource Attributes |
Duration |
This is a required parameter. All API queries should be accompanied with this parameter.
Aggregate report(s) for the specified duration. |
Query Type |
|
|
Sorting |
You should use both these parameters. If you use either, you will not receive data in the response.
|
|
Lazy Loading |
You should use both these parameters. If you use either, you will not receive data in the response.
|
|
Data Retrieval Option |
|
|
Filtering |
Filter parameters restrict the data to be included the response.
|
|
Device |
|
|
Request Headers |
Host, Accept, Authorization |
|
Response Headers |
Content-Type, Content-Length, Connection |
Comparing API Data with the Web Interface Data
The new web interface uses the AsyncOS APIs to fetch data with the duration attribute specified in the GMT time zone. If you plan to compare the data from your API query with the new web interface data, ensure that your API query has the same time range (in ISO8601 time format) as the new web interface API query.
Examples
Examples of the types of reporting queries are shown below:
Retrieving a Single Value for a Counter
This example shows a query to retrieve a single value for a counter.
Sample Request
GET /wsa/api/v2.0/reporting/web_malware_category_malware_name_user_detail/
blocked_malware?startDate=2017-11-14T02:00+00:00&endDate=2018-02-18T01:00+00:00&
filterValue=23&filterBy=na&filterOperator=is&device_type=wsa
HTTP/1.1
cache-control: no-cache
Authorization: Basic YWRtaW46aXJvbnBvcnQ=
User-Agent: curl/7.54.0
Accept: */*
Host: wsa.cisco.com:6080
accept-encoding: gzip, deflate
Connection: keep-alive
Sample Response
HTTP/1.1 200 OK
Server: API/2.0
Date: Mon, 26 Nov 2018 16:29:33 GMT
Content-type: application/json
Content-Length: 193
Connection: close
Access-Control-Allow-Origin: *
Access-Control-Allow-Headers: content-type, jwttoken, mid, h, email
Access-Control-Allow-Credentials: true
Access-Control-Allow-Methods: GET, POST, DELETE, OPTIONS
Access-Control-Expose-Headers: Content-Disposition, jwtToken
{
"meta": {
"totalCount": 4
},
"data": {
"type": "blocked_malware",
"resultSet": {
"blocked_malware": [
{
"10.8.93.12": 137511
},
{
"10.8.93.20": 112554
},
{
"10.8.93.11": 92839
},
{
"10.225.98.234": 6
}
]
}
}
}
Retrieving Multiple Values for a Counter
This example shows a query to retrieve multiple values for a counter with the order direction and device type parameters.
Sample Request
GET /wsa/api/v2.0/reporting/web_services_summary?orderBy=transaction_total&
orderDir=desc&startDate=2018-08-16T18:00:00.000Z&endDate=2018-11-15T10:00:00.000Z&device_type=wsa
HTTP/1.1
cache-control: no-cache
Authorization: Basic YWRtaW46aXJvbnBvcnQ=
User-Agent: curl/7.54.0
Accept: */*
Host: 10.8.159.21:6080
accept-encoding: gzip, deflate
Connection: keep-alive
Sample Response
HTTP/1.1 200 OK
Server: API/2.0
Date: Sun, 18 Nov 2018 15:38:52 GMT
Content-type: application/json
Content-Length: 403
Connection: close
Access-Control-Allow-Origin: *
Access-Control-Allow-Headers: content-type, jwttoken, mid, h, email
Access-Control-Allow-Credentials: true
Access-Control-Allow-Methods: GET, POST, DELETE, OPTIONS
Access-Control-Expose-Headers: Content-Disposition, jwtToken
{
"meta": {
"totalCount": -1
},
"data": {
"type": "web_services_summary",
"resultSet": [
{"detected_by_traffic_monitor": 0},
{"detected_malware_total": 42},
{"high_risk_transaction_total": 7109},
{"blocked_by_admin_policy": 0},
{"detected_by_amp": 0},
{"allowed_transaction_total": 26369},
{"transaction_total": 33478},
{"blocked_or_warned_by_webcat": 29},
{"blocked_by_wbrs": 7038},
{"blocked_by_avc": 0}
]
}
}
Retrieving Single Values for Each Counter in a Counter Group
A counter group may have multiple counters. This example shows a query to retrieve single values for each counter in a counter group with the filter, device type, and top parameters.
Sample Request
GET /wsa/api/v2.0/reporting/web_application_type_detail/bw_not_limited?startDate=
2017-09-10T19:00:00.000Z&endDate=2018-09-24T23:00:00.000Z&device_type=wsa&filterValue=
F&filterOperator=begins_with&filterBy=na&top=2
HTTP/1.1
cache-control: no-cache
Authorization: Basic YWRtaW46aXJvbnBvcnQ=
User-Agent: curl/7.54.0
Accept: */*
Host: 10.8.159.21:6080
accept-encoding: gzip, deflate
Connection: keep-alive
Sample Response
HTTP/1.1 200 OK
Server: API/2.0
Date: Sun, 18 Nov 2018 15:48:21 GMT
Content-type: application/json
Content-Length: 138
Connection: close
Access-Control-Allow-Origin: *
Access-Control-Allow-Headers: content-type, jwttoken, mid, h, email
Access-Control-Allow-Credentials: true
Access-Control-Allow-Methods: GET, POST, DELETE, OPTIONS
Access-Control-Expose-Headers: Content-Disposition, jwtToken
{
"meta": {
"totalCount": 2
},
"data": {
"type": "bw_not_limited",
"resultSet": {
"bw_not_limited": [
{"File Sharing": 84},
{"Facebook": 42}
]
}
}
}
Retrieving Multiple Values for Multiple Counters
Here is an example of a query that retrieves multiple values for multiple counters, including offset, limit, and device type parameters.
Sample Request
GET /wsa/api/v2.0/reporting/web_services_summary?offset=0&limit=20&
startDate=2020-04-10T07:00:00.000Z&endDate=2020-04-11T08:00:00.000Z&device_type=wsa& HTTP/1.1
cache-control: no-cache
Postman-Token: 692fd2a6-3da7-4bc1-b581-f4b478b5a304
Authorization: Basic YWRtaW46aXJvbnBvcnQ=
User-Agent: PostmanRuntime/7.6.0
Accept: */*
Host: pod1224-wsa04.ibwsa.sgg.cisco.com:6080
accept-encoding: gzip, deflate
Connection: keep-alive
Sample Response
HTTP/1.1 200 OK
Date: Sat, 11 Apr 2020 07:42:04 GMT
Content-type: application/json
Content-Length: 387
Connection: close
Access-Control-Allow-Origin: *
Access-Control-Allow-Headers: content-type, jwttoken, mid, h, email
Access-Control-Allow-Credentials: true
Access-Control-Allow-Methods: GET, POST, DELETE, PUT, OPTIONS
Access-Control-Expose-Headers: Content-Disposition, jwtToken
{"meta": {"totalCount": -1}, "data": {"type": "web_services_summary", "resultSet":
[{"detected_by_traffic_monitor": 0}, {"detected_malware_total": 0}, {"high_risk_transaction_total": 0},
{"blocked_by_admin_policy": 0}, {"detected_by_amp": 0}, {"allowed_transaction_total": 0},
{"transaction_total": 0}, {"blocked_or_warned_by_webcat": 0}, {"blocked_by_wbrs": 0},
{"blocked_by_avc": 0}]}}
Retrieving Multiple Values for Multiple Counters, with Multiple Values for Each Counter
This example shows a query to retrieve multiple values for multiple counters with the offset and limit parameters and query type parameters.
Sample Request
GET /wsa/api/v2.0/reporting/web_application_name_application_type_detail?startDate
=2017-08-16T18:00:00.000Z&endDate=2018-11-15T15:00:00.000Z&device_type=wsa&query_type=export
HTTP/1.1
cache-control: no-cache
Authorization: Basic YWRtaW46aXJvbnBvcnQ=
User-Agent: curl/7.54.0
Accept: */*
Host: 10.8.159.21:6080
accept-encoding: gzip, deflate
Connection: keep-alive
Sample Response
HTTP/1.1 200 OK
Server: API/2.0
Date: Sun, 18 Nov 2018 15:55:50 GMT
Content-type: application/json
Content-Length: 1258
Connection: close
Access-Control-Allow-Origin: *
Access-Control-Allow-Headers: content-type, jwttoken, mid, h, email
Access-Control-Allow-Credentials: true
Access-Control-Allow-Methods: GET, POST, DELETE, OPTIONS
Access-Control-Expose-Headers: Content-Disposition, jwtToken
{
"meta": {
"totalCount": -1
},
"data": {
"type": "web_application_name_application_type_detail",
"resultSet": {
"time_intervals": [
{
"end_timestamp": 1538332199,
"counter_values": [
{
"counter_values": [
42,
25932,
0,
42,
0,
42,
0
],
"application_type": "File Sharing",
"counter_key": "4shared"
},
{
"counter_values": [
2,
109614,
0,
2,
0,
2,
0
],
"application_type": "Media",
"counter_key": "Dailymotion"
},
{
"counter_values": [
42,
20748,
0,
42,
0,
42,
0
],
"application_type": "Facebook",
"counter_key": "Facebook General"
},
{
"counter_values": [
42,
20580,
0,
42,
0,
42,
0
],
"application_type": "File Sharing",
"counter_key": "MediaFire"
},
{
"counter_values": [
229,
158838,
0,
229,
0,
229,
0
],
"application_type": "Social Networking",
"counter_key": "Twitter"
},
{
"counter_values": [
1,
86334,
0,
1,
0,
1,
0
],
"application_type": "Instant Messaging",
"counter_key": "Wechat_web"
},
{
"counter_values": [
44,
40876,
0,
44,
0,
44,
0
],
"application_type": "Media",
"counter_key": "YouTube"
}
],
"begin_timestamp": 1530383400,
"end_time": "2018-09-30T23:59:00.000Z",
"begin_time": "2018-07-01T00:00:00.000Z"
}
],
"counter_names": [
"bw_not_limited",
"bandwidth_used",
"bw_limited",
"completed_transaction_total",
"blocked_transaction_total",
"transaction_total",
"blocked_by_avc"
]
}
}
}