This is the third and probably last post in the Certifications by API series. The first post detailed retrieving and searching campaigns, the second post detailed creating and starting campaigns. If you haven’t read those, check them out as they will give you the background for this one.
As detailed in the previous two posts this post also assumes you are authenticated to IdentityNow as detailed in this post, and you understand that this post details accessing Certifications using the non-versioned SailPoint IdentityNow API’s.
With that all said, this post details obtaining Certification Reports from Completed Campaigns. The process goes like this;
- Search and return Completed Campaigns
- Identify campaigns completed within a time period
- Retrieve and export the CSV completion reports
Note: The first time you access the getReports API for a Campaign the Reports are automatically generated. You can and should include additional logic to catch that the request for the report fails and wait a minute before retrying when the report has been generated allowing you to then retrieve it.
As mentioned above the getReports API is used to get a list of reports from campaigns.
To get an individual report the report/get API call is used along with the ID of the report to retrieve. The base URI is;
Exporting Certification Campaign Completion Reports
The following PowerShell script will enumerate completed campaigns, compare the completion time to the current time and the time window to export (last 7 days in my example below) and export the CSV version of the reports to a directory on the host running the script.
- Line 11 for the number of days previous to days date to retrieve reports on
- Line 34 for the output CSV path. The exports are named based on the Description of the Campaign, so you’ll need to modify that if all your descriptions are the same
The output is the CSV File which can then be manipulated in PowerShell or Excel (via Data => Import CSV.
Using the Certifications API we can query for Completed Certification Campaigns and then retrieve their complete reports and export them to the file system. Likewise with a few simple changes you can also export the other reports.