The Foundation API is a useful tool for pulling back data from Hub. However, depending on how much data there is it can be overwhelming to consume. Moreover, this can make it difficult to find the exact data you are looking for.
Thankfully the API has filter option that will allow the user to filter on a item contained within a Foundation resource. This post will go over a few examples of filtering commands.
Example 1: Looking at user logins to Foundation
https://
- ?\$filter: This tells the call to filter the JSON contents on a specific field
- =category: this is the field being filtered on, in this case its the category of the audit event
- eq: this stands for equal, the call will pull back a records with a specified value
- 'Authentication': The value being filtered
This call is filtering all audit events with the event category of Authentication. Do note that the last value has to be in single quotes and is case sensitive.
Example 2: Looking at audit events over a specific time period
https://
- =timestamp: setting the filter on the timestamp in which the event was created
- gt: stands for greater than, the filter will search for a value greater than the one specified
- '2021-12-01T00:00:00Z': the first date to for the filter to run against
- and: indicates a second value to be filtered against
- lt: stands for less than, the filter will search for a value less than the one specified
- '2021-12-31T23:59:59Z': the second date to be filtered against
This call is pull all audit events for the month of December. For this call note that the date follows the following format YYYY-MM-DDTHH:MM:SS:Z where the time follows a 24hr clock. Also the a T must be placed before the hour and a Z after the seconds.
There are many items a user can run a filter call against. To determine what those items are, run a simple get call against a Foundation resource and pick an entry. Here note the items available and test it out.