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

How to retrieve all the defects using OSLC REST API?

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?

0 votes



3 answers

Permanent link
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.





0 votes

Comments

 

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).

 

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?



 

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)

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

0 votes


Permanent link

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.

0 votes

Comments

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

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 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
× 12,020

Question asked: May 04 '16, 6:09 p.m.

Question was seen: 3,504 times

Last updated: Dec 28 '16, 2:00 p.m.

Confirmation Cancel Confirm