msingh39  
                
                  
                    November 11, 2024,  9:56am
                   
                  1 
               
             
            
              Hi Folks,
Anyone knows how to execute Optimized Aggregation via API?
I am trying below one’s but it seems outdated and not in use. Any alternative?
https://uxxxxxx.com/api/source/:id/loadAccounts https://uxxxxxx.com/api/source/loadAccounts/:id 
Thanks
             
            
              
            
           
          
            
              
                gogubapu  
              
                  
                    November 11, 2024, 10:07am
                   
                  2 
               
             
            
              Hi @msingh39 ,
Use Below curl for unoptimized aggregation:
curl --location --request POST 'https://{{tenant}}.api.identitynow-demo.com/beta/sources/{{SourceId}}/load-accounts' \
--header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsIn' \
--form 'disableOptimization="true"'
Optimized Aggregation:
curl --location --request POST 'https://{{tenant}}.api.identitynow-demo.com/beta/sources/{{SourceId}}/load-accounts' \
--header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsIn' \
--form 'disableOptimization="false"'
Thanks
             
            
              
            
           
          
            
              
                gourab  
              
                  
                    November 11, 2024, 10:30am
                   
                  3 
               
             
            
            
              
            
           
          
            
              
                KRM7  
                
                  
                    November 11, 2024, 10:31am
                   
                  4 
               
             
            
              
You can use VSCode extension, right click on your source
             
            
              3 Likes 
            
            
           
          
            
              
                msingh39  
              
                  
                    November 11, 2024, 11:34am
                   
                  5 
               
             
            
              Thanks for the response. I tried it and got below error:-
Invoke-RestMethod : A parameter cannot be found that matches parameter name ‘form’.
… 0fea1225/load-accounts’ -Method ‘GET’ -Headers $headers -form 'disabl … 
                                                        ~~~~~
CategoryInfo          : InvalidArgument: ( 
FullyQualifiedErrorId : NamedParameterNotFound,Microsoft.PowerShell.Commands.InvokeRestMethodCommand 
 
 
 
             
            
              
            
           
          
            
              
                msingh39  
              
                  
                    November 11, 2024, 11:38am
                   
                  6 
               
             
            
              I also got below error after removing “-Form” :-
Invoke-RestMethod : {“error”:“No message available”}
             
            
              
            
           
          
            
              
                gogubapu  
              
                  
                    November 11, 2024, 11:43am
                   
                  7 
               
             
            
              Hi,
Use below powershell code lines to execute successfully:
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Content-Type", "multipart/form-data")
$headers.Add("Accept", "application/json")
$headers.Add("Authorization", "Bearer <TOKEN>")
$multipartContent = [System.Net.Http.MultipartFormDataContent]::new()
$stringHeader = [System.Net.Http.Headers.ContentDispositionHeaderValue]::new("form-data")
$stringHeader.Name = "disableOptimization"
$stringContent = [System.Net.Http.StringContent]::new("true")
$stringContent.Headers.ContentDisposition = $stringHeader
$multipartContent.Add($stringContent)
$body = $multipartContent
$response = Invoke-RestMethod 'https://sailpoint.api.identitynow.com/v2024/sources/:id/load-accounts' -Method 'POST' -Headers $headers -Body $body
$response | ConvertTo-Json
Thanks
             
            
              
            
           
          
            
            
              Powershell 5.1 does not support -Form parameter for invoke-restmethod.
             
            
              
            
           
          
            
            
              Hi @mahira_majgaonkarpp 
POST ## https://sailpoint.api.identitynow.com/beta/sources/:id/load-accounts 
Path variable: sourceid
             
            
              
            
           
          
            
              
                gogubapu  
              
                  
                    November 12, 2024,  5:02am
                   
                  10 
               
             
            
              Hi @msingh39 ,
I have tested below PowerShell script, it is working as expected:
$bearerToken = "hLTExNjUwIiwiaWRlbnRpdHlfaWQiOiIzMWUwZDU1OGY3ZmY0M2Y5OGJiOTQyNzk3YTg3ODhmNCIsInVzZXJfbmFtZSI6ImJhcHUuZ29ndSIsInNjb3BlIjpbIkJnQUFBQUFBQUFRPSJdLCJzdHJvbmdfYXV0aCI6dHJ1ZSwiZXhwIjoxNzMxNDI4NTI4LCJhdX"
# Run optimized or UnOptimized Aggregation using below
$header = @{
    "Authorization" = "Bearer $bearerToken"
}
$body = @{
"disableOptimization" = "false"
}
$response = Invoke-RestMethod -Method Post ` -Uri "https://tenant-sb.api.identitynow-demo.com/beta/sources/118e606ed9ee4ee7ab70b6f70ad2aa5f/load-accounts" ` -Headers $header -Body $body
echo $response
Click on below link for more details  : import-accounts | SailPoint Developer Community 
             
            
              
            
           
          
            
              
                KRM7  
              
                  
                    November 12, 2024,  8:46am
                   
                  11 
               
             
            
              I don’t think @msingh39  is looking for a script to aggregate to do some customizations, believe he is just looking for running aggregation through API, this is quite normal, we do run lot of API calls in our day to day activities.
Do we really need some scripting, why are you complicating this ?
Make it simple, either use API in Postman or use VSCode extension. Make your life easier.
             
            
              1 Like 
            
            
           
          
            
              
                system  
              
                  
                    January 11, 2025,  8:47am
                   
                  12 
               
             
            
              This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.