How to read the values of custom workitem attributes using REST
I am trying to use the REST API on Jazz 4.6 to access a workitem. All works well for the 'normal' attributes but our workitems have several custom fields. These do not appear in the results of my query. How can I read the values of the custom attributes in a workitem using the REST API?
For instance, I use the following query to access the contents of workitem 6460:
https://myjazzserver:9443/jazz/oslc/contexts/_8IloQGRKEeGMeeKcLm-Fsg/workitems?oslc_cm.query=dc:identifier="6460"
Alternatively I use:
https://myjazzserver:9443/jazz/resource/itemName/com.ibm.team.workitem.WorkItem/6460?_mediaType=text/json
both return the predefined attrributes but neither return the custom attributes.
Many thanks.
For instance, I use the following query to access the contents of workitem 6460:
https://myjazzserver:9443/jazz/oslc/contexts/_8IloQGRKEeGMeeKcLm-Fsg/workitems?oslc_cm.query=dc:identifier="6460"
Alternatively I use:
https://myjazzserver:9443/jazz/resource/itemName/com.ibm.team.workitem.WorkItem/6460?_mediaType=text/json
both return the predefined attrributes but neither return the custom attributes.
Many thanks.
2 answers
Like Donald, I can also see custom attributes returned by a request of this format: https://myjazzserver:9443/jazz/resource/itemName/com.ibm.team.workitem.WorkItem/6460?_mediaType=text/json
In any case, try the following query to get the display value of an enumeration literal id:
https://server:port/ccm/rpt/repository/workitem?fields=workitem/projectArea/enumerations/literals[id='Development_Fix_Plan.literal.l1']/name
In my testing this query returns a large number of empty tags like this:
<enumerations></enumerations>
but only one tag that actually has a value:
<enumerations><literals><name>$</name></literals></enumerations>
Depending on how many enumerations are defined in your instance you may have to page through the result set to see the correct value.
In any case, try the following query to get the display value of an enumeration literal id:
https://server:port/ccm/rpt/repository/workitem?fields=workitem/projectArea/enumerations/literals[id='Development_Fix_Plan.literal.l1']/name
In my testing this query returns a large number of empty tags like this:
<enumerations></enumerations>
but only one tag that actually has a value:
<enumerations><literals><name>$</name></literals></enumerations>
Depending on how many enumerations are defined in your instance you may have to page through the result set to see the correct value.
Comments
Dave Sinclair
Jan 22 '15, 6:25 p.m.Dave Sinclair
Jan 22 '15, 6:27 p.m.Donald Nong
Jan 22 '15, 9:01 p.m.1 vote
Dave Sinclair
Jan 23 '15, 3:40 a.m.