Is there a specific api call to list users of a sp...
# gooddata-platform
j
Is there a specific api call to list users of a specific project? I see the one for the entire domain.
m
Hey Josh. How are you? Sure, we have it: /gdc/projects/{project_id}/users
šŸ™Œ 1
We also have /gdc/account/profile/{profile_id}/projects if you would like to do it in the other way.
šŸ™Œ 1
j
Thank, @Martin Burian! Is there also a parameter where I could simply list their role, ie editor, etc?
m
The role is part of the body of the response.
What you can do is /gdc/projects/PID/roles/ ā€¦ then click to the role you are insterested in, and then users
j
I see it listed as uri ending with 1 or 2 or 11 for example, Iā€™m looking for the human readable value for what the 1 or 2 or 11 equate to.
I can manually do it of course, just wanted to do something at scale.
m
I would use our ruby sdk for something like that.
Please see:
Copy code
require 'gooddata'

GoodData.with_connection('user','password') do |client|
   GoodData.with_project('PID') do |project|
     rows = project.users.to_a.map do |user|
       [user.email, user.full_name, user.role.title]
     end
     table = Terminal::Table.new :headings => ['Email', 'Full Name', 'Role'], :rows => rows
     puts table
   end
end
result:
image.png