API query to list all project areas an user belongs to
![]()
Hi,
I am looking for ways to list down all project areas an user belongs to using RQM REST API/java API.
I know that this REST API query: <server>/qm/service/com.ibm.rqm.integration.service.IIntegrationService/resources/projects returns a list of all the projects present in the server but I want user to just view the project areas they are a member of.
Furthermore I am developing this functionality with JAVA backend so I believe a java api will also suffice.
Any hints on how to easily achieve this is appreciated.
Thank you in advance.
|
Accepted answer
![]()
Ralph Schoon (60.5k●3●36●43)
| answered May 03, 4:45 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
Since the question does not provide what the purpose of the endeavor is, here some summary of what could be looked at:
Jitesh Saha selected this answer as the correct answer
Comments
Hi Ralph,
Thanks for your input. The EWM API works perfectly with ETM and got the job done for me.
For anyone who is also looking for the same solution I am pasting the unit test i the next comment.
|
One other answer
![]()
Unit test to the solution:
@Test
public void run() throws TeamRepositoryException { TeamPlatform.startup(); try { String repositoryURI = "" ; //Your Repository Here String userId = "" ; //Your username Here String password = " " ; //Your Password
String memberUser = "" ; // The user for whom you want the project areas to be listed
ITeamRepository teamRepository = TeamPlatform.getTeamRepositoryService().getTeamRepository(repositoryURI); teamRepository.registerLoginHandler(new LoginHandler(userId, password)); teamRepository.login(null); System.out.println("Logged in as: " + teamRepository.loggedInContributor().getName()); if (projectAreaName == null) { // For all project areas IProcessItemService itemService = (IProcessItemService) teamRepository.getClientLibrary(IProcessItemService.class); List pAreas = itemService.findAllProjectAreas(null, null); for (Iterator iterator = pAreas.iterator(); iterator.hasNext();) { IProjectArea projectArea = (IProjectArea) iterator.next(); IContributor user = teamRepository.contributorManager().fetchContributorByUserId(memberUser , null); if (projectArea.hasMember(user)) { System.out.println(projectArea.getName()); } } } teamRepository.logout(); } catch (TeamRepositoryException x) { x.printStackTrace(); } finally { TeamPlatform.shutdown(); } } |