Giuseppe is correct… the maximum limit per page is 250 (see Search | SailPoint Developer Community)
Based on the documentation, I was also in the assumption that even with pagination we can get maximum 250 records per page but when I tested with large limit value, I was able to get expected result. But it is working fine until 10,000 as limit after that it’s throwing an error which I was expecting it’ll throw if I give anything above 250 as limit.
Error - {“detailCode”=>“400.1 Bad request content”, “trackingId”=>"", “messages”=>[{“locale”=>“en-US”, “localeOrigin”=>“DEFAULT”, “text”=>“The request was syntactically correct but its content is semantically invalid.”}], “causes”=>}.
@colin_mckibben can you please confirm on this?
You can try this API - https://{tenant}.api.identitynow.com/cc/api/app/list
You can use the searchAfter field to get beyond the 10,000 with the search APIs. For example, here is my PS that uses searchAfter:
For($i=0;$i -le $Pagecount;$i++){
#Search query
$searchBody= '{“query”: {“query”: “created:[now-1d TO now] AND type:*”},
“sort”:[“id”],
“searchAfter”:["’ + $searchAfter + '"]
}’
write-output “Page $i of $Pagecount; Last ID from previous set: $searchAfter”
$Results = Invoke-WebRequest -Method POST -Uri https://$($org).api.identitynow.com/v3/search/events?limit=1 -Headers @{Authorization= “Bearer $token”} -body $searchBody -ContentType “application/json”
$Content= $Results.Content.Substring($Results.content.indexof("[")+1, $Results.content.LastIndexOf("]")-1)
$Content | out-file “C:\Users\justin.haines\OneDrive - Optiv Security Inc\Events.json” -Append
$searchAfter= $Content.substring($Content.IndexOf(“id`”:")+6,31)
}
Hope you are doing Great…
i do have a doubt regarding above powershell
Doubt:-How can we tell powershell to sort by "Id " before the method invocation because
we are getting the Id from the result
The first result will not use any searchAfter value. In fact, I set it to a default value for logging purposes:
$searchAfter = “None (First Set)”
For($i=0;$i -le $Pagecount;$i++){
#Search query
$searchBody= '{“query”: {“query”: “created:[now-1d TO now] AND type:*”},
“sort”:[“id”],
“searchAfter”:["’ + $searchAfter + '"]
}’
write-output “Page $i of $Pagecount; Last ID from previous set: $searchAfter”
$Results = Invoke-WebRequest -Method POST -Uri https://$($org).api.identitynow.com/v3/search/events?limit=1 -Headers @{Authorization= “Bearer $token”} -body $searchBody -ContentType “application/json”
…