Search query to get list of certication campigns for this month

search query to get list of certication campigns for this month

Use this type:“CERTIFICATION” AND created:[now-1M TO now]

Hi @mrahulbb

If you are looking for events of campaign creation :
name:"Create Certification Campaign Passed"

Thanks
Sid

I dont think we have search query for Certification campaign data. We need to either go to certifications page in UI and filter basedon date (like for may) or run API and use filtering mechanisms in it and try. Can others say if there is SEARCH QUERY from UI which can do the above?

Hi @mrahulbb there is no search query but you can use script for this as shown below

# Define variables
$identityNowHost = "https://devrel-ga.api.identitynow-demo.com"
$clientId = ""
$clientSecret = "3e5df001fba2531c959a78605d5a7e83357631978d16f70a05f6e86f096e2636"
$outputCsv = "C:\Users\Public\Downloads\Certifications.csv"  # Path for the output CSV file
 
function Get-AccessToken {
    $authUrl = "$identityNowHost/oauth/token"
    $authBody = @{
        grant_type    = "client_credentials"
        client_id     = $clientId
        client_secret = $clientSecret
    }
 
    Write-Host "Auth URL: $authUrl" -ForegroundColor Green
 
    $response = Invoke-RestMethod -Method Post -Uri $authUrl -ContentType "application/x-www-form-urlencoded" -Body $authBody
    return $response.access_token
}
 
# Retrieve the access token
$accessToken = Get-AccessToken
 
$headers = @{
    Authorization  = "Bearer $accessToken"
    "Content-Type" = "application/json"
}
 
# Initialize variables
$baseUrl = "$identityNowHost/v2024/certifications"
$allCertifications = @()
$hasMore = "true"
$offset = 0
$limit = 250  # Adjust as needed based on API documentation
 
Write-Host "Base URL: $baseUrl" -ForegroundColor Green
 
$url = $baseUrl + "?count=" + $hasMore
 
# Fetch the total count
try {
 
    Write-Host "Fetch Total Count URL: " + $url
 
    $totalCountResponse = Invoke-WebRequest -Uri $url -Method 'GET' -Headers $headers
 
    $totalCount = $($totalCountResponse.Headers['X-Total-Count'])
    Write-Host "Response Total: $totalCount" -ForegroundColor Cyan
}
catch {
    Write-Host "Error calling API: $($_.Exception.Message)" -ForegroundColor Red
    throw
}