Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

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.

0 votes


Accepted answer

Permanent link
Since the question does not provide what the purpose of the endeavor is, here some summary of what could be looked at:

  1. The API landing page is here: https://jazz.net/wiki/bin/view/Deployment/CLMProductAPILanding check the available APIs
  2. 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.
  3. 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.
  4. 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.
Jitesh Saha selected this answer as the correct answer

0 votes

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

Permanent link
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();
    }

  }

0 votes

Your answer

Register or log in to post your answer.

Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 10,927

Question asked: May 03 '22, 2:43 a.m.

Question was seen: 1,744 times

Last updated: May 10 '22, 3:35 a.m.

Confirmation Cancel Confirm