Campaign filter creation API with bulk entitlements

Hi Team,

Do we have API to create a campaign filter either inclusion or exclusion with bulk set of entitlements?

Thanks
Kalyan

Hi @kalyannambi2010 ,
We have API to create campaign filter. Check this.

You can use PowerShell script to create a JSON body for bulk entitlements. I have attached script for the same. Hope it helps
CampaignFilterScript.zip (850 Bytes)

1 Like

@JackSparrow Great, but what should be the input csv format?
e.g.

Ent_value1
Ent_value2
Ent_value3

@sagar_kamalakar yes, without any headers.

Hi @JackSparrow thank you for your reply and I am unable to generate the JSON body.

Thanks
Kalyan

Something like this should work substituting the values you need :slight_smile:

{
  "name": "Identity Attribute Campaign Filter",
  "description": "Campaign filter to certify data based on an identity attribute'\''s specified property.",
  "owner": "SailPoint Support",
  "mode": "INCLUSION",
  "criteriaList": [
    {
      "type": "IDENTITY_ATTRIBUTE",
      "property": "displayName",
      "value": "support",
      "operation": "CONTAINS",
      "negateResult": false,
      "shortCircuit": false,
      "recordChildMatches": false,
      "id": null,
      "suppressMatchedItems": false,
      "children": null
    }
  ],
  "isSystemFilter": false
}

Are you getting any error?

I am not getting any error and but not generating any JSON body

Did you gave the input to the script and change the path accordingly? Also do necessary changes to the script if required.

$Ent_Data = Import-Csv -path “C:\Users\theja.chandra.reddy\Downloads\Test.csv”

I have updated the script as below and try to execute this ps script but no JSON output created.

#Specify the path of input file
$Ent_Data = Import-Csv -path “C:\Users\nambi\Downloads\Test.csv”

#Specify the output path
$jsonFilePath = “C:\Users\nambi\Downloads\Test.json”

#Initialize an array to store JSON objects
$jsonArray = @()

#Import the module for ordered dictionaries
Import-Module Microsoft.PowerShell.Management -Force

#Iterate through each data in the input file
foreach($data in $Ent_Data){
$Ent_Value = $null
$Ent_Value = $data.EntValue
$parent = [ordered]@{
“type” = “COMPOSITE”
“property” = “displayableName”
“value” = $Ent_Value
“operation” = “OR”
“negateResult” = $false
“shortCircuit” = $false
“recordChildMatches” = $false
“id” = $null
“suppressMatchedItems”= $false
“children” = @(
#Define the first child hashtable
[ordered]@{
“type” = “ENTITLEMENT”
“property” = “displayableName”
“value” = $Ent_Value
“operation” = “EQUALS”
“negateResult” = $false
“shortCircuit” = $false
“recordChildMatches” = $false
“id” = $null
“suppressMatchedItems”= $false
“children” = $null
},
#Define the second child hashtable
[ordered]@{
“type” = “ENTITLEMENT”
“property” = “application”
“value” = “F5-Concur”
“operation” = “EQUALS”
“negateResult” = $false
“shortCircuit” = $false
“recordChildMatches” = $false
“id” = $null
“suppressMatchedItems”= $false
“children” = $null
}
)
}

#Add each block of code to array
$jsonArray += $parent

}#For loop

#Convert to JSON
$jsondata = $jsonArray | ConvertTo-Json -Depth 50

#Write the updated JSON content to the out file
$jsondata | Set-Content -Path $jsonFilePath -Force

Thanks
Kalyan

Hope you have given the entitlements in test.csv file.

Yes, I have given in spreadsheet without headers

Sorry, my bad. We should give column header in the input file as EntValue

image

Yes, I have given in spreadsheet column header in the input file as EntValue but no JSON body file generated.