How to access custom attributes of a particular work item from a particualr work area of RTC via API?
Amol Wangate (15●1●9)
| asked Jun 17 '19, 10:15 a.m.
edited Jun 18 '19, 1:28 a.m. by Ralph Schoon (63.5k●3●36●46) Need to access attributes of a work item which is in RTC work area
|
Accepted answer
You should be able to use this:
<...>/ccm/rpt/repository/workitem?fields=workitem/workItem[projectArea/name='Defect Management']/(id|summary|allExtensions[displayName='External Id']/(displayName|displayValue))
I have found that sometimes the Reportable REST API will permit searches on fields but will not always return data for them - it may be that you get an empty field where displayValue should be. You may need to fiddle
Amol Wangate selected this answer as the correct answer
Comments
Thanks Davyd. It worked!
Just wondering if we have similar/such API's that returns data in JSON format instead of XML. I know I can parse this XML into JSON. Just wanted to avoid extra efforts.
Davyd Norris
commented Jun 19 '19, 4:50 p.m.
No unfortunately - the Reportable REST API only returns XML. The OSLC API returns a range of formats including JSON.
I agree - the XML is a bit of a pain, especially when you can only use the built in Javascript (or common browser libraries if you know it's client side execution)
Amol Wangate
commented Jun 25 '19, 11:28 a.m.
Davyd - where can I get that OSLC API? I tried looking for it and got it but it was in rdf+xml format. Would u be able to provide me the link? would rather like to go with OSLC API if it indeed provides data in JSON format.
Ralph Schoon
commented Jun 25 '19, 12:31 p.m.
| edited Jun 25 '19, 12:31 p.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
Google for OSLC, it is a standard.
The standard specifies what is supported/must be supported and the common standard used to be xml+rdf in the past. So only a very few OSLC API implementations support JSON.
You can look up the OSLC Workshop on this site for more information. An implementation that helps with implementing access to the API is the Eclipse Lyo project.
Davyd Norris
commented Jun 25 '19, 8:32 p.m.
I had to add my reply as a separate answer because I didn't have enough characters - see below
|
2 other answers
The OSLC API will give you back XML, JSON or ATOM feed data. To get JSON, add .json to your URL, and the 'Accept: application/json' header to your request. So for instance you can use this to get a list of Filed Against categories:
var xhrArgs = {
jazzClient.xhrGet(xhrArgs).then(function(data) {
data['oslc_cm:results'].forEach(function(item) { var cat = { name : item['dc:title'],
fullName: item['rtc_cm:hierarchicalName'],
id : item['rdf:resource'].split('/').pop(),
};
};
};
Comments
Amol Wangate
commented Jun 27 '19, 8:32 a.m.
This is helpful. Thank u Davyd!
any input on this question: https://jazz.net/forum/questions/263815/how-to-get-all-records-from-reportable-rest-api
|
One last question Davyd & Ralph -
I've this REST API : https://xyx:8085/ccm/rpt/repository/workitem?fields=workitem/workItem[projectArea/name='Defect Management']/(id|summary|allExtensions[displayName='External ID']/(displayName|displayValue)) and it only returns limited number of recrods. However, I need all. What changes do I need to make to the mentioned url to get all the records.
Comments
Davyd Norris
commented Jun 28 '19, 6:39 p.m.
How many records does it return?
Amol Wangate
commented Jul 01 '19, 5:55 a.m.
100 records by default
|
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
No details => No answers. QED
The API you are trying to access is the reportable REST API and I am not an expert in that one, however, REST APIs usually return all available information about an artifact and it is up to you to parse the data to get the information you are interested in.
If this is indeed about the reportaable REST API, then here should be information about what you are interested in: https://jazz.net/wiki/bin/view/Main/ReportsRESTAPI#Field_selection_and_filtering you can get there from https://jazz.net/help-dev/clm/index.jsp?topic=%2Fcom.ibm.team.reports.doc%2Ftopics%2Fr_ccm_rest_api.html