How to fetch subscribers name and userid for particular workitem through REST SDK API
How to fetch subscribers name and userid for particular workitem through REST SDK API |
One answer
Ralph Schoon (63.4k●3●36●46)
| answered Nov 16 '19, 2:59 p.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER edited Nov 16 '19, 2:59 p.m.
wi.getSubscriptions() returns a collection. The way you cast indicates you do not see the information. See https://rsjazz.wordpress.com/2015/09/30/learning-to-fly-getting-started-with-the-rtc-java-apis/ how to set this up to be able to see the info.
There is no magic here. You iterate the subscribers and resolve the handles. The reverse API is explained here https://rsjazz.wordpress.com/2012/08/02/subscribing-to-a-work-item-using-the-java-api/ Comments Hi Ralph
I am getting below error
Exception in thread "main" java.lang.ClassCastException: com.sun.proxy.$Proxy10 incompatible with com.ibm.team.rtc.foundation.api.common.model.IContributor
Below is my code :
public static void Subs(ITeamRepository repo, IWorkItem wi) throws TeamRepositoryException{
IWorkItem workitem = workitemClient.findWorkItemById(id, IWorkItem.FULL_PROFILE, null);
for(IContributorHandle subscriber : workitem.getSubscriptions().getContents())
{
IItemManager itemManager = repo.itemManager();
IContributor contributor = (IContributor) itemManager.fetchCompleteItem(subscriber , IItemManager.DEFAULT, null);
contributor.getUserid();
}
}
This is development and not a guessing game. As far as I can tell, you have the following options:
You are asking others to do 1,2 or 3 to help you and that is not a great idea. The next question from you is already in the forum.
|
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.
Comments
Below is my code but its showing com.ibm.team.workitem.common.internal.model.Subscriptions incompatible with com.ibm.team.repository.common.IContributorHandle error