Skip to content

Instantly share code, notes, and snippets.

@phi1ipp
Last active July 6, 2021 15:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save phi1ipp/56f644dfa995bff63ecb2e4913515b3d to your computer and use it in GitHub Desktop.
Save phi1ipp/56f644dfa995bff63ecb2e4913515b3d to your computer and use it in GitHub Desktop.
How to grab data about Okta groups from Okta Admin console
function loop(i) {
setTimeout(() => {
fetch('https://' + domain + '/admin/groups/search?iColumns=8&sColumns=id%2Cname%2CappName%2CappDisplayName%2Cdescription%2CuserCount%2CappCount%2CdirCount&orderBy=name&sortDirection=asc&maxResults=100&iDisplayStart=' + i + '&sSearch=')
.then(resp => resp.text())
.then(data => {
var json = JSON.parse(data.substring(11)); // 11 is a number of first symbols to remove from the result,
// as it's always "while(1){};"
console.log(json.aaData); // just for visual progress tracking
aaData = aaData.concat(json.aaData);
if (i < upper)
loop(i + 100)
})
}, timeout)
}
var domain = 'you_domain.okta.com';
var timeout = 10000;
var upper = 20000;
var i = 0;
var aaData = [];
loop(i)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment