Foundation API CSV Reporting

The Foundation API is the primary tool for checking the data in the application. The data retrieve comes back with JSON. However, the data tends to come back as a wall of text. This makes it difficult to use it for reporting purposes. 

Thankfully the API has a command that allows you convert the JSON data into a .csv file. Here is a use case:

A user wants to generate a report of all of the users who logged into Foundation over the month of December. The first thing you want to do is create the GET call returning this data. in this case the call would be:

https:///foundation/hub/api/v1/auditevents?\\\$filter=category eq 'Authentication' and timestamp ge '2021-12-09T00:00:00Z' and  timestamp le '2021-12-09T23:59:59Z'

Make sure to run the call to make sure it works. If it does pull back the data then at the end of the above URL add "&\\\$format=csv".

https:///foundation/hub/api/v1/auditevents?\\\$filter=category eq 'Authentication' and timestamp ge '2021-12-09T00:00:00Z' and  timestamp le '2021-12-09T23:59:59Z'&\\\$format=csv

Once executed it will start a download on a csv file in the browser. This file will have all of the same data as the call allowing the user to open in excel and modify as they see fit.

There is another post that goes over the filter function in the API. If you would like a breakdown of the call then go to that post​​​​​​​ to learn more.