It's all about the answers!

Ask a question

Is it possible to check Related -> Type in Java API?

Karthik Krishnan (8825119163) | asked May 14 '13, 7:04 a.m.
edited May 15 '13, 3:12 a.m.
 I am trying to build the following filter (Query building) using Plain Java API 

Type: Defect AND Related (Link) -> Type is: Task AND Defect Status is UnResolved

I am able to do this in Web client. Just that I am not sure how to get the "Related" link's type using API

Edit: I need to build the below using Expressions in Plain Java API. Is this possible?
Query filters

Millard Ellingsworth commented May 14 '13, 6:55 p.m.

Have you looked at this blog post from Ralph about working with the Work Item Linking API?

Karthik Krishnan commented May 15 '13, 3:07 a.m.

Yes, but I am looking for how to build  "Related" Links in query filter using Plain Java API 

Karthik Krishnan commented May 15 '13, 11:35 a.m. | edited May 15 '13, 12:04 p.m.


Karthik Krishnan commented May 18 '13, 1:23 a.m.

Is this possible at all using API's?  Reason is I cannot achieve this using Eclipse client where as it's possible using web client 

Karthik Krishnan commented May 23 '13, 10:04 a.m.

Hello Ralph Schoon  

Would you be able to be help me here?

Ralph Schoon commented May 23 '13, 11:16 a.m. | edited May 23 '13, 11:18 a.m.

I would suggest - like Millard - to start with my blog. Start here:

The blog contains articles about server and client link API's and also how to programmatic create and use queries, if you want that. If you can do it with the WebUI normal query mechanism you could do it using the API. See:

If the Eclipse and the Web UI behave differently, this is a defect you should report.

Dependant on what you want to do, you can do more with the API e.g. investigate the data in work items, look at links etc. See for example or

showing 5 of 6 show 1 more comments

One answer

permanent link
praveen patidar (8623544) | answered May 14 '13, 8:25 p.m.

Hello ,

I am not sure about the API type(Server side or client side.). I am providing you for client side API to get Related artifact. If you want server side as well let me know.

List<IReference> relatedRefs = workItemClient.resolveWorkItemReferences(
    retrofitWI, null).getReferences(WorkItemEndPoints.RELATED_WORK_ITEM);
  for (IReference relatedRef : relatedRefs) {
   if (relatedRef.resolve() instanceof IWorkItemHandle){
    IWorkItem relatedWI= auditableClient.resolveAuditable((IWorkItemHandle) relatedRef.resolve(),IWorkItem.FULL_PROFILE, null);

String stateName = WorkflowUtilities.findWorkflowInfo(
        relatedWI, null).getStateName(relatedWI.getState2());
       System.out.println("Type  "+relatedWI.getWorkItemType());

       System.out.println("State Name  "+stateName);



Karthik Krishnan commented May 15 '13, 3:13 a.m.

Thanks for this but I want to have this in the Filter condition of  a query. I've edited my post with a screenshot. Please check that 

Your answer

Register or 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.