Reports
/report
Request method: GET
Description: Returns all of the reports that are available to a user. Runs through the Unified API.
Output:[ { "data": [ { "id": "1", "name": "Top Source IPs", "parameters": { "limit": 10, "schedule": { "type": "daily", "hour": "15" }, "output": "csv" }, "ownerId": "1" }, { "id": "2", "name": "Top Source IPs", "parameters": { "limit": 10, "schedule": { "type": "daily", "hour": "17" }, "output": "csv" }, "ownerId": "1" }, { "id": "3", "name": "Top Source IPs", "parameters": { "limit": 10, "schedule": { "type": "daily", "hour": "17" }, "output": "csv" }, "ownerId": "1" } ] } ]
Response codes:
200 OK
- List of reports is returned
/report/create
Request method: POST
Description: Adds a new report to the system. This endpoint accepts a JSON payload with the following keys:
report_type
- Type of report to run, such asTopSrcIp
parameters
- JSON object that has the following keys:limit
- Number of elements to limit the report by. Should default to10
schedule
- JSON object that allows a report to be scheduled:type
-daily
,weekly
, ormonthly
values to specify when the report should runhour
- Hour this report should run, defaults to0
minute
- Minute this report should run, defaults to0
day_of_month
- For monthly reports, the date of the month the report should run (1
-31
)day_of_week
- For weekly reports, the day of the week (1
-7
)
output
- Output of the report,csv
,json
,xml
email
- E-mail address to send the report toname
- Name to give the report, should be a string less than 255 characters
Output:[ { "data": { "id": "3", "report_type": "TopSrcIp", "name": "Top Source IPs", "parameters": { "limit": 10, "schedule": { "type": "daily", "hour": "17" }, "output": "csv" }, "owner_id": "1" } } ]
Response codes:
201 Created
- Report was created
/report/single
Request method: GET
Description: Same as querying the Unified API.
Output:[ { "data": { "id": "1", "report_type": "TopDestCountries", "name": "Top source IPs", "parameters": { "limit": 10, "schedule": "weekly", "output": "xml" }, "owner_id": "1" } } ]
Response codes:
200 OK
- Report details are returned404 Not Found
- Report could not be found
/report/:id
Request method: POST
Description: Updates an existing report. Users are allowed to modify the Name and Parameters of a report. They are not allowed to modify the type of report. This takes the same payload as POST /report
Output:[ { "data": { "id": "1", "report_type": "TopDestCountries", "name": "Top Source IPs", "parameters": { "limit": 10, "schedule": { "type": "daily", "hour": "15" }, "output": "csv" }, "owner_id": "1" } } ]
Response codes:
201 Created
- Report details are updated403 Forbidden
- User does not have access404 Not Found
- Report could not be found
/report/:id/run
Request method: POST
Description: CSV report is returned.
Output:[ { "data": { "title": "Top Source IPs", "format": "csv", "report": "ID,Count,Country\n1,15,192.168.1.100\n2,10,172.16.0.500" } } ]
Response codes:
200 OK
- Report text is returned403 Forbidden
- User does not have access404 Not Found
- Report could not be found
/report-archive
Request method: GET
Description: Report archive list is returned.
Output:[ { "data": [ { "id": "1", "report_id": "1", "run_date": "2017-04-27 15:30:08", "user_id": "1", "metadata": null }, { "id": "2", "report_id": "1", "run_date": "2017-04-27 15:34:35", "user_id": "1", "metadata": null } ] } ]
Response codes:
200 OK
- Report archive list is returned404 Not Found
- Report could not be found
/report-archive/single
Request method: POST
Description: Uses the Unified API. Can query a specific report_id
to get the archives back for an individual report.
Output:[ { "data": { "id": "1", "report_id": "4", "run_date": "2017-04-27 15:30:08", "data": "{\"headers\":{\"id\":\"ID\",\"count\":\"Count\",\"src_ip\":\"IP Address\",\"src_country_code\":\"Country\"},\"data\":[{\"id\":1,\"count\":\"58812\",\"src_ip\":\"172.22.61.234\",\"src_country_code\":\"xx\"},{\"id\":2,\"count\":\"18360\",\"src_ip\":\"192.168.248.165\",\"src_country_code\":\"xx\"},{\"id\":3,\"count\":\"2104\",\"src_ip\":\"2600:1003:b108:c89d:2c24:a7cb:20f8:fd2b\",\"src_country_code\":\"US\"},{\"id\":4,\"count\":\"986\",\"src_ip\":\"192.168.23.16\",\"src_country_code\":\"xx\"},{\"id\":5,\"count\":\"876\",\"src_ip\":\"172.16.1.14\",\"src_country_code\":\"xx\"},{\"id\":6,\"count\":\"791\",\"src_ip\":\"192.168.32.5\",\"src_country_code\":\"xx\"},{\"id\":7,\"count\":\"584\",\"src_ip\":\"174.117.47.90\",\"src_country_code\":\"CA\"},{\"id\":8,\"count\":\"486\",\"src_ip\":\"172.16.1.12\",\"src_country_code\":\"xx\"},{\"id\":9,\"count\":\"457\",\"src_ip\":\"10.1.10.107\",\"src_country_code\":\"xx\"},{\"id\":10,\"count\":\"351\",\"src_ip\":\"174.117.73.73\",\"src_country_code\":\"CA\"}]}", "user_id": "1", "metadata": null } } ]
Response codes:
200 OK
- Report text is returned404 Not Found
- Report could not be found404 Not Found
- Archive for a report could not be found500 Internal Error
- Invalid result set