Actions
Feature #8180
closedInclude project members in project API response
Status:
Closed
Priority:
Normal
Assignee:
-
Category:
REST API
Target version:
-
Start date:
2011-04-18
Due date:
% Done:
0%
Estimated time:
Resolution:
Duplicate
Description
I am creating Chrome Extension to Redmine and need some informations from API.
I want to get one project data (/projects/project.xml) with associated users.
I have checked the source of show.api.rsb and as I understand this - there is only
posibility to get project data with associated trackers.
Related issues
Updated by Jakub Wolny over 13 years ago
In the end of show.api.rsb I have added and it seems to work:
api.array :members do @project.members.each do |member| api.member(:id => member.id, :name => member.name, :user => member.user_id) end end if include_in_api_response?('members')
Updated by Jakub Wolny over 13 years ago
I have improved it a little bit:
api.array :members do @project.members.each do |member| member.roles do |role| api.role(:role => role.id) end api.member(:id => member.id, :name => member.name, :user => member.user_id, :login => member.user.login, :mail => member.user.mail, :roles => member.roles) end end if include_in_api_response?('members') api.array :memberroles do @users_by_role.keys.sort.each do |role| api.memberroles(:id => role.id, :name => role.name, :users => @users_by_role[role].sort) end end if include_in_api_response?('memberroles') api.array :roles do @users_by_role.keys.sort.each do |role| api.roles(:id => role.id, :name => role.name) end end if include_in_api_response?('roles')
So you can fetch members, roles and combined. I only do not know how to "in proper way" show only neccessary user fields (without e.g. password hash and salt)
Updated by Edward Subraman over 13 years ago
This is unrelated to this issue. How do I create a new project in this system?
Updated by Jakub Wolny over 13 years ago
Edward Robson Subraman: you can create a new project by making POST request, as it described here:
http://www.redmine.org/projects/redmine/wiki/Rest_Projects
Updated by Jean-Philippe Lang over 13 years ago
- Tracker changed from Defect to Feature
- Subject changed from project with associated users to Include project members in project API response
Updated by Jean-Philippe Lang almost 13 years ago
- Status changed from New to Closed
- Resolution set to Duplicate
See #7420. Memberships API is added for 1.4.
Actions