It's all about the answers!

Ask a question

How to programmatically get list of all filed against values?


0
1
M M (323) | asked Sep 05 '14, 11:36 p.m.
edited Sep 08 '14, 2:26 a.m. by Ralph Schoon (55.1k23642)

I am using perl to  programmatically get a list of Filed Against values.

$url/ccm/oslc/context/$UID/shapes/workitems/com.ibm.team.apt.workItemType.story/property/category/allowedValues

results in

<?xml version="1.0"?>
<rdf:RDF
  xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
  xmlns:oslc="http://open-services.net/ns/core#">
  <oslc:AllowedValues rdf:about="$url/ccm/oslc/context/_Z2CigCMREeSu9IVVns_JHg/shapes/workitems/com.ibm.team.apt.workItemType.story/property/category/allowedValues">
    <oslc:allowedValue rdf:resource="$url/ccm/resource/itemOid/com.ibm.team.workitem.Category/_bW4qMCMREeSu9IVVns_JHg"/>
    <oslc:allowedValue rdf:resource="$url/ccm/resource/itemOid/com.ibm.team.workitem.Category/_aG6QECMREeSu9IVVns_JHg"/>
    <oslc:allowedValue rdf:resource="$url/ccm/resource/itemOid/com.ibm.team.workitem.Category/_bV_5YCMREeSu9IVVns_JHg"/>
    <oslc:allowedValue rdf:resource="$url/ccm/resource/itemOid/com.ibm.team.workitem.Category/_bW9isCMREeSu9IVVns_JHg"/>
    <oslc:allowedValue rdf:resource="$url/ccm/resource/itemOid/com.ibm.team.workitem.Category/_bXIh0CMREeSu9IVVns_JHg"/>
    <oslc:allowedValue rdf:resource="$url/ccm/resource/itemOid/com.ibm.team.workitem.Category/_bXDCQCMREeSu9IVVns_JHg"/>
    <oslc:allowedValue rdf:resource="$url/ccm/resource/itemOid/com.ibm.team.workitem.Category/_bWkhICMREeSu9IVVns_JHg"/>
    <oslc:allowedValue rdf:resource="$url/ccm/resource/itemOid/com.ibm.team.workitem.Category/_bV2IYCMREeSu9IVVns_JHg"/>
    <oslc:allowedValue rdf:resource="$url/ccm/resource/itemOid/com.ibm.team.workitem.Category/_bWRmMCMREeSu9IVVns_JHg"/>
    <oslc:allowedValue rdf:resource="$url/ccm/resource/itemOid/com.ibm.team.workitem.Category/_bXbcwCMREeSu9IVVns_JHg"/>
    <oslc:allowedValue rdf:resource="$url/ccm/resource/itemOid/com.ibm.team.workitem.Category/_bXgVQCMREeSu9IVVns_JHg"/>
    <oslc:allowedValue rdf:resource="$url/ccm/resource/itemOid/com.ibm.team.workitem.Category/_bXlNwCMREeSu9IVVns_JHg"/>
    <oslc:allowedValue rdf:resource="$url/ccm/resource/itemOid/com.ibm.team.workitem.Category/_bWuSICMREeSu9IVVns_JHg"/>
  </oslc:AllowedValues>
</rdf:RDF>

I then iterate through each <oslc:allowedValue rdf:resource to request the title of each category:

i.e.

$url/ccm/resource/itemOid/com.ibm.team.workitem.Category/_bW4qMCMREeSu9IVVns_JHg

returns

<?xml version="1.0"?>
<rdf:RDF
  xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
  xmlns:rtc_cm="http://jazz.net/xmlns/prod/jazz/rtc/cm/1.0/"
  xmlns:dcterms="http://purl.org/dc/terms/">
  <rtc_cm:Category rdf:about="$url/ccm/resource/itemOid/com.ibm.team.workitem.Category/_bW4qMCMREeSu9IVVns_JHg">
    <rtc_cm:depth rdf:datatype="

Accepted answer


permanent link
Donald Nong (14.3k211) | answered Sep 08 '14, 3:21 a.m.
I think you'd better use the reportable REST API to get the categories.
https://clm:9443/ccm/rpt/repository/workitem?fields=workitem/category/*
You may need to fine tune the output using field filtering and selection.
https://jazz.net/wiki/bin/view/Main/ReportsRESTAPI#Field_selection_and_filtering

M M selected this answer as the correct answer

Comments
1
M M commented Sep 08 '14, 2:24 p.m.

The reportable REST API and filtering is giving me better results:

https://ccm/rpt/repository/workitem?fields=workitem/category[contextId='$contextID' and archived='false']/(contextId|itemId|name|qualifiedName|archived)

The only potential issue I can see is that the values returned are for all workitem types.   If a task and story have different values, I am not sure how to obtain these using the Reportable Rest API.


Donald Nong commented Sep 08 '14, 9:10 p.m.

You change your mind so it becomes an issue. :-)
If you want to get the categories "being used" (as opposed to "available"), you need to query from the existing work items. Something like this.

https://clm/ccm/rpt/repository/workitem?fields=workItem/workItem[type/id="task"]/category/*

One other answer



permanent link
Farheen Aslam (311) | answered Jun 05 '17, 8:16 a.m.

Is it possible to get the enum attributes in workitem say list of "priorities" or "severity"


Comments
Ralph Schoon commented Jun 05 '17, 9:56 a.m. | edited Jun 05 '17, 10:04 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

Please read How should I ask a question in the Forum if I want to receive useful answers? and create your own question instead of answering with a question at a totally unrelated question (that is already answered and correctly three years ago). Thank you.

Your answer


Register or to post your answer.