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
Since the question does not provide what the purpose of the endeavor is, here some summary of what could be looked at:
-
The API landing page is here: https://jazz.net/wiki/bin/view/Deployment/CLMProductAPILanding check the available APIs
-
The 4 APIS that are documented here contain the Reportable REST API and the OSLC API. The reportable RESt API mentions https://jazz.net/wiki/bin/view/Main/RqmApi#Project_Area_Metadata_Viewer_AN1 and also in 7.x filter capabilities. This might be a way. I am not sure if the OSLC API provides this information.
- ETM does not provide a JAVA API like EWM does, BUT parts of the EWM API covers the Jazz Foundation and it might be possible to use that against ETM. https://rsjazz.wordpress.com/2012/12/09/analyzing-a-aroject-areas-members-and-roles-using-the-plain-java-client-libraries/ contains examples for finding such information in EWM.
-
The Jazz Foundation API https://jazz.net/wiki/bin/view/Main/DraftTeamProcessRestApi , https://jazz.net/wiki/bin/view/Main/JazzRESTServicesMain might provide the desired information. I noticed that some of the user related queries do not work any more due to concerns with privacy.
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
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();
}
}