msingh39
(Maninder Singh)
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
(bapu gogu)
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
Bapu
gourab
(Gourab Sadhukhan)
November 11, 2024, 10:30am
3
MVKR7T
(Krishna Mummadi)
November 11, 2024, 10:31am
4
You can use VSCode extension, right click on your source
2 Likes
msingh39
(Maninder Singh)
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: ( [Invoke-RestMethod], ParameterBindingException
FullyQualifiedErrorId : NamedParameterNotFound,Microsoft.PowerShell.Commands.InvokeRestMethodCommand
msingh39
(Maninder Singh)
November 11, 2024, 11:38am
6
I also got below error after removing “-Form” :-
Invoke-RestMethod : {“error”:“No message available”}
gogubapu
(bapu gogu)
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
Bapu
Powershell 5.1 does not support -Form parameter for invoke-restmethod.
Either install Powershell 7, use C# objects or use CURL. Curl is built in into windows 10+. CURL was added to Windows 10 (1803) and later.
Hi @mahira_majgaonkarpp
try below API it worked for me:
POST ## https://sailpoint.api.identitynow.com/beta/sources/:id/load-accounts
Path variable: sourceid
Request body: disableOptimization true
gogubapu
(bapu gogu)
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
Thank You.
MVKR7T
(Krishna Mummadi)
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
(system)
Closed
January 11, 2025, 8:47am
12
This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.