It's all about the answers!

Ask a question

some questions about Reportable REST API


0
2
Karthik Krishnan (849388127) | asked Apr 24 '14, 12:01 p.m.
As a follow up of https://jazz.net/forum/questions/149119/is-it-possible-to-access-work-item-history-via-plain-java-api-or-oslc 

My goal is to find out the status (change) of workitem at different (changed) dates (for each workitem satisfying a query)

I was able to play around for sometime with the Reportable REST API and was able to get the worktiem history

Regarding the status I see something like this in the history

<predecessor>_AZrXQcu5EeO08OhFHLECUA</predecessor>

How can I find out to which state this _AZrXQcu5EeO08OhFHLECUA belongs to?
 
Also I read that the Reportable REST API is different from regular OSLC for work items. This means that I will not be able to execute a predefined query via Reportable REST API  right? 


Comments
1
sam detweiler commented Apr 24 '14, 12:19 p.m.

one of the state entries should have that tag as its itemId field. (that is the UUID of the workitem state)

https://localhost:9143/ccm/rpt/repository/workitem?fields=workitem/workItem/%28id|summary|itemId%29
returns

<workitem Version="1.0.0" rel="next" href="https://localhost:9143/ccm/rpt/repository/workitem?fields=workitem%2FworkItem%2F%28id%7Csummary%7CitemId%29&id=_DYAO8MvMEeOjLf0lpIM4lw&size=100&pos=100"><workItem><id>1</id><summary>Define a new build</summary><itemId>_tLAlEEPTEeOc2Lc7Sj4jWg</itemId></workItem><workItem><id>2</id><summary>Share code with Jazz Source Control</summary><itemId>_tlJjYEPTEeOc2Lc7Sj4jWg</itemId></workItem><workItem><id>3</id><summary>Define sprints/iterations</summary><itemId>_toVaQEPTEeOc2Lc7Sj4jWg</itemId></workItem><workItem><id>4</id><summary>Define categories and releases for work items</summary><itemId>_tqZ20EPTEeOc2Lc7Sj4jWg</itemId></workItem>


Karthik Krishnan commented Apr 24 '14, 12:37 p.m.

I see the ItemID but what could I infer from this? How can I relate this to state name?


1
sam detweiler commented Apr 24 '14, 12:39 p.m.

if you add itemId as  as one of the fields returned for each state, this field should match the predecessor field on a later state.

using the itemId field should allow you to build the state order tree,


Karthik Krishnan commented Apr 24 '14, 12:49 p.m.
  <workItem><id>1</id><summary>Define a new build</summary><itemId>_tLAlEEPTEeOc2Lc7Sj4jWg</itemId><itemHistory>
<uniqueId>707e191eee2d66c30ddb629ee93cfeaa</uniqueId><reportableUrl>https://local:9443/ccm/rpt/repository/workitem/workItem/id/1</reportableUrl><itemType>com.ibm.team.workitem.WorkItem</itemType><stateId>_tLAlEEPTEeOc2Lc7Sj4jWg</stateId><itemId>_4swH0Mu4EeOC06Ycw7syxQ</itemId><contextId>_jyhKXgFQEeKMMvMBRZWeZg</contextId><modified>2014-04-24T16:02:00.756+0200</modified><predecessor>_AZrXQcu5EeO08OhFHLECUA</predecessor></itemHistory></workItem>
 
 Is my XML I get. I want to get the state name of predecessor. How can I get this. Is there something like a mapping table with UuId and state name?

sam detweiler commented Apr 24 '14, 1:13 p.m.

ok, its stateid and predecessor

this
https://localhost:9143/ccm/rpt/repository/workitem?fields=workitem/workItem/%28id|summary|itemId|itemHistory/%28stateId|predecessor%29%29

yields

this
<workItem><id>7</id><summary>fribble</summary><itemId>1EHXgEiCEeOJEeGE8YExBw</itemId><itemHistory><stateId>_z2k6oMoZEeOjy4RglL53dA</stateId><predecessor>_oVGrUnFgEeOw56cxmubVJQ</predecessor></itemHistory><itemHistory><stateId>_oVGrUnFgEeOw56cxmubVJQ</stateId><predecessor>-OQw0U4-EeOhD8kQDn6qiA</predecessor></itemHistory><itemHistory><stateId>_-OQw0U4-EeOhD8kQDn6qiA</stateId><predecessor>_9MSYgUiCEeORtsQwGYgl8A</predecessor></itemHistory><itemHistory><stateId>_9MSYgUiCEeORtsQwGYgl8A</stateId><predecessor/></itemHistory></workItem>


Karthik Krishnan commented Apr 25 '14, 4:07 a.m.

Thanks Sam. Yes I get the stateid and predecessor. What i need is after reading predecessor I need to report this with state name like New / in Progress etc.


What I am asking is how can I get the names associated with this UUID. Is there a way to check this?

Sorry If I had missed the obvious 

showing 5 of 6 show 1 more comments

Accepted answer


permanent link
sam detweiler (12.4k6171200) | answered Apr 25 '14, 7:55 a.m.
sorry, state and list of states (set of attributes at point in time) makes for confusing talk.

you want the text value of the status field of each workitem change in its history...

this works
https://localhost:9143/ccm/rpt/repository/workitem?fields=workitem/workItem/%28id|summary|itemId|itemHistory/%28stateId|predecessor|state/name%29%29

returns

<workItem><id>7</id><summary>fribble</summary><itemId>_1EHXgEiCEeOJEeGE8YExBw</itemId><itemHistory>
<stateId>_IMLykcxvEeOjLf0lpIM4lw</stateId>
<predecessor>_z2k6oMoZEeOjy4RglL53dA</predecessor>
<state><name>In Progress</name></state>
</itemHistory>
<itemHistory>
<stateId>_oVGrUnFgEeOw56cxmubVJQ</stateId>
<predecessor>_-OQw0U4-EeOhD8kQDn6qiA</predecessor>
<state><name>New</name></state>

</itemHistory>
<itemHistory>
<stateId>_-OQw0U4-EeOhD8kQDn6qiA</stateId><predecessor>_9MSYgUiCEeORtsQwGYgl8A</predecessor>
<state><name>New</name></state>
</itemHistory>
<itemHistory>
<stateId>_9MSYgUiCEeORtsQwGYgl8A</stateId>
<predecessor/>
<state><name>New</name></state>
</itemHistory>
<itemHistory>
<stateId>_z2k6oMoZEeOjy4RglL53dA</stateId>
<predecessor>_oVGrUnFgEeOw56cxmubVJQ</predecessor>
<state><name>New</name></state>
</itemHistory>
</workItem>

Karthik Krishnan selected this answer as the correct answer

Comments
Karthik Krishnan commented Apr 25 '14, 8:44 a.m.

Super! Thanks a lot. Worked. 


I was using this 
 

and didn't get state values..

after looking at your example this worked


Many thanks.

Also this gave me all


1
sam detweiler commented Apr 25 '14, 8:48 a.m.

thanks.. was wondering how wildcarding would work.

One other answer



permanent link
Rohit Rishabh (153616) | answered Jun 25 '15, 1:53 p.m.
Hi Karthik/Sam,

I have a similar requirement where I am trying to pull out history (Defect State and the date when the state was changed).
My goal is to list history for all defects that has a values "Release 8.2.05" under a custom attribute "defect.attribute.FoundinRelease".

The previous examples above passing 'id' as the parameter, how can I pass my custom attribute's value as parameter.

Here is the property of the custom attribute
<key>defect.attribute.FoundinRelease</key>
<type>smallStringValue</type>
<booleanValue/>
<integerValue/>
<longValue/>
<doubleValue>0.0</doubleValue>
<smallStringValue>enumeration.foundinrelease.literal.l11</smallStringValue>
<displayName>Found in Release</displayName>
<displayValue>Release 8.2.05</displayValue>

Comments
Rohit Rishabh commented Jun 25 '15, 2:38 p.m.

Also, along with the release name, I would like to filter the result only for "Defect" work item type.


Donald Nong commented Jun 25 '15, 10:53 p.m.

I believe you cannot filter on "customAttributes" or "allExtensions" as they are both multi-valued and a filter requires a single value.
As for filtering on work item type, you can use the filter like this

?fields=workitem/workItem[type/id='defect']/*

Your answer


Register or to post your answer.