I have a requirement where i need to get all the user roles in my org and then get users in each role.Below is the expected response .
{ "Role": "xyz", "Users": { "a","b" }
I created a proxy with target url as management api to get all roles and added JS policy.
var userroles = []
userroles=context.getVariable("response.content");
for(var i = 0 ;i < userroles.length; i++)
{ print("userroles are " + userroles[i]) }
Now i want to use each userrole in different policy,how can that be done
Solved! Go to Solution.
Now i want to use each userrole in different policy,how can that be done
What do you mean by this? I think you want to query the list of users for each role in the system.
That's not a good use case for Apigee, or for the JS callout. The JS callout can send an HTTP request outbound, but there are limitations. For example, there is a maximum time that a JS policy will execute.
It feels to me, that a better way to do this is just to write a script (nodejs, bash, powershell, etc) that does the work for you, and run that script.
The logic is
?