GET /api/report/get/{reportId}

This endpoint has been replaced by

https://developer.sailpoint.com/idn/api/v3/get-report

Download a campaign report

  1. Use https://developer.sailpoint.com/idn/api/v3/get-active-campaigns to find a completed campaign.
  2. Use https://developer.sailpoint.com/idn/api/v3/get-campaign-reports to get the ID of one of the reports generated for the campaign.
  3. Use https://developer.sailpoint.com/idn/api/v3/get-report-result to check the status of the report. It must be complete before you can download it.
  4. Download the CSV report using the taskResultId from step 3 in this endpoint. https://developer.sailpoint.com/idn/api/v3/get-report using a request like this: curl --location 'https://devrel.api.identitynow.com/v3/reports/2c9180857d2eb81b017d33432b4f7de9?fileFormat=csv'

I’m getting an error while running the above API to fetch Campaign Status Report, the error says → api_get': undefined local variable or method reportId’ for main:Object (NameError)
if (stringUrl.index(“/v3/reports/#{reportId}?format=csv”))

Any help is appreciable. Thanks

Are you setting the reportId variable?
If in doubt, print out / log your stringUrl so you can verify

I’m trying to download the campaign reports in pdf format and this method above doesn’t work. The report is not the result of a task - so there’s no task ID to plug into the get-report-result or get-report endpoint. When I tried plugging in the campaign or the individual report IDs, I get the response “error”:“no message available”.

I can download the PDF from the front-end and have tried to use developer console to figure out what is being called there, but it opens in a pop-up window and the endpoint isn’t available in any way I can see.

I am able to download a campaign report as a PDF.

Are you sure you followed the steps exactly as described above?

Not sure why, but my PDFs aren’t rendering properly and appear blank

CSVs seem to work fine

param($campaign_id,$output_directory)

Import-Module PSSailPoint

$reportTypes = @("CAMPAIGN_COMPOSITION_REPORT", "CAMPAIGN_REMEDIATION_STATUS_REPORT", "CAMPAIGN_STATUS_REPORT", "CERTIFICATION_SIGNOFF_REPORT")
$campaign_name = (Get-ActiveCampaigns -filters "id eq `"$($campaign_id)`"").name


$file_path = $output_directory + "\" + $campaign_name

if(-not(Test-Path -Path $file_path -PathType Container)){
    New-Item -Path $file_path -ItemType Directory
}

Write-Host "Beginning report generation for campaign $($campaign_name)"

foreach ($reportType in $reportTypes) {
    Start-CampaignReport -Id $campaign_id -Type $reportType
    $report = Get-CampaignReports -Id $campaign_id | Where-Object { $_.reportType -eq $reportType }
    Write-Host "Started refresh of report $($report.name)"
    
    Start-Sleep 20
    
    $file_name = "$($campaign_name) - $($report.name) - $($report.lastRunAt.ToString("yyyy-MM-dd")).pdf"
    Get-Report -taskResultId $report.id -fileformat pdf | Out-File "$($file_path)\$($file_name)"
    
    if ($reportType -eq "CAMPAIGN_STATUS_REPORT") {
        $file_name = "$($campaign_name) - $($report.name) - $($report.lastRunAt.ToString("yyyy-MM-dd")).csv"
        Get-Report -taskResultId $report.id -fileformat csv | Out-File "$($file_path)\$($file_name)"
    }
}

I’m not sure if anyone can do it any other way, but when trying to write campaign reports to a file, I cannot use the get-reports cmdlet and have to use invoke-restmethod so that I can use the -outfile parameter to get the file to write properly.

I updated that code in my post