It's all about the answers!

Ask a question

How to retrieve all the defects using OSLC REST API?


Amarnathreddy Kashireddy (1111) | asked May 04 '16, 6:09 p.m.
I got a requirement to retrieve all the defects irrespective of project areas they are in.

I am trying to access the following URL through browser.

https://localhost:port/ccm/rpt/repository/workitem?fields=workitem/workItem[...]/displayFields&size=500

I am getting 500 error.

Can you please help me with it?

3 answers



permanent link
Hakki Bozkurt (1631328) | answered May 05 '16, 2:49 a.m.
Hi Amarnathreddy,

I think we can't get work items irrespective of project areas 
but,
we can get all project areas from server 
and, 
we can create a loop for each project area defect items using RTC Plain Java Libs.

Browsers does not always show the correct query result but API shows. If you want to develop an API for it I can help you.






Comments
Amarnathreddy Kashireddy commented May 05 '16, 10:43 a.m. | edited Dec 28 '16, 2:00 p.m.

 

I appreciate your reply.

@Hakki Bozkurt

I have developed a Java module which retrieves/creates Work Items using Plain Java LIB. It is running successfully.

 

I am planning to replace that with OSLC/REST API because of the following reasons.

 

  • We are using a tool which is capable importing the data from external systems(Ex: RTC). We can specify a URL and map the XML output data from external systems to the tool.

  • Presently Plain Java RTC code is sitting in some other system, which gets the data, parses and feeds it to the tool. I want to completely avoid the java program(If possible).

  • REST is new and it is most suitable for our tool.

 

@Donald Nong

There are less than 500 defects. I will be fetching the defects which were created/modified in past one week and it’s  hardly around 10 defects. I am sorry! for the self made URL, I am confused after searching for long for the URL in jazz.net. I couldn't get it right.

 

 

Can you help me with the following operations getting through OSLC/REST?

1. Filter defects based on custom attribute (my case the custom attribute is 'subtype') across all the project areas

(or)

2. Get all the project areas and get the filtered defects from project area based on custom attribute (subtype).

 


Hakki Bozkurt commented May 05 '16, 11:43 a.m. | edited May 05 '16, 11:52 a.m.
Do you have any a piece of code about jazz oslc api? login server, httputils, etc?
Can you get any oslc query result using jazz oslc api?



 

Amarnathreddy Kashireddy commented May 05 '16, 11:59 a.m.

I am able retrieve id|summary from the RTC but I am not really sure how to apply filter for the defects and also filter based on custom attribute (our case 'subtype').

https://localhost/ccm/rpt/repository/workitem?fields=workitem/workItem/(id|summary)


Donald Nong commented May 05 '16, 11:46 p.m.

Have you checked the examples in the API reference? There are quite a few and you should get a clear idea how it works.
https://jazz.net/wiki/bin/view/Main/ReportsRESTAPI#Examples

In your case, it depends on how the "subtype" attribute is displayed. Note that the filter can only applied to single-valued attributes.


permanent link
Donald Nong (14.5k614) | answered May 05 '16, 5:27 a.m.
The three dots in the square brackets [...] looks quite bizarre. Does the URL that you used really look like this? If true, the syntax is simply wrong, hence the 500 error. I don't know how many attributes you want to retrieve from the work items, but you can start with "?fields=workitem/workItem/id".

Note that retrieving huge volume of data out of the server can put pressure on the server, and even bring it down. Proceed with caution.

permanent link
Amarnathreddy Kashireddy (1111) | answered May 06 '16, 10:51 a.m.
edited May 06 '16, 10:53 a.m.

Thanks for helping me through thinking process. I was looking at the link page before. But it started making sense to me while I was going through your answers and google search.

I came up with the following URL. Assuming it helps people in future who refers this post. It is working fine for me.

>https://localhost/ccm/rpt/repository/workitem?fields=workitem/workItem[type/id=<DefectId>]/(summary|type/name|id|projectArea/name|state/name|severity/name|priority/name|owner/userId|plannedEndDate|allExtensions/(key|type|booleanValue|decimalValue|doubleValue|integerValue|longValue|timestampValue|smallStringValue|mediumStringValue|largeStringValue|displayName|displayValue))

 I couldn't apply filter on custom attribute (subtype) which is part of allExtentions. But there are multiple allExtentions.

Subtype location is "allExtentions/displayName" and it's value location is "allExtentions/displayValue"

Let me know if it s possible.


Comments
Donald Nong commented May 09 '16, 12:24 a.m.

Since "allExtentions" is multivalued, it is not possible to apply a filter to it (you will get an error if you try to), unfortunately.


Amarnathreddy Kashireddy commented May 10 '16, 11:11 a.m.

Thank you for the reply. I finally decided to retrieve all the defects and filter them out in my tool. I wanted to avoid retrieving unwanted defects in the first place but it is not possible. I felt RTC REST API is not matured enough.

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.