How to extract users associated with an Edge organization?

The UI does not have an export option. What is the easiest way to complete this request without copying and pasting from the UI? The curl call to list users does not provide all the required information (User, Email, Role) from the UI.

1 2 775
2 REPLIES 2

To get list of all users and their email addresses + user roles you would need to execute several calls. Here is how to do it :

1) Run curl -u <orgadmin> <mgmt_ip>:<mgmt_port>/v1/users/ call to get list of all users
2) Then iterate through the list of users create in 1) and run following call : curl -u <orgadmin> <mgmt_ip>:<mgmt_port>/v1/users/<user_email> - this will give you details like email address, first and last name
3) If you require also information about user roles following call provides it: curl -u <orgadmin> <mgmt_ip>:<mgmt_port>/v1/users/<user_email>/userroles

This is basically what UI does. Unfortunately this information can not be obtained by executing one api call.

The solution offered by @Akash Prabhashankar doesn't work for Public Cloud, as normally you can't iterate through all users in the cloud using /v1/users.

I think that "GET /v1/organization/{orgname}/users" to retrieve all users for a given org would be a useful API, but it doesn't exist in the cloud.

You can use an iterating solution similar to Akash's for cloud, though.

1) Retrieve all user roles for an org:

curl -u <orgadmin> https://api.enterprise.apigee.com/v1/organizations/{orgname}/userroles

2) For each user role, retrieve the email addresses of users with that role in the org:

curl -u <orgadmin> https://api.enterprise.apigee.com/v1/organizations/{orgname}/userroles/{rolename}/users

The list of all email addresses associated with the org is the combined list from all of these calls.

3) The above call only returns an array of email addresses though -- if you want the first and last names of the admins, you can get them one by one:

curl -u <orgadmin> https://api.enterprise.apigee.com/v1/organizations/{orgname}/userroles/{rolename}/users/{email}