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

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.


0 votes

Comments

Thanks for the answer, Brian.  The Reportable REST API helps a bit.  However I still can't resolve the actual values of the customisable attributes.  Here's an example of my problem:

We have a customised attribute in our Workitem called Dev_Fix_Plan_Attribute.  It is a smallStringValue so when I do a query like:

https://myjazzserver:9443/jazz/rpt/repository/workitem?fields=workitem/workItem[id=41608]/(/)

to get everything about workitem 41608 the Dev Fix Plan attribute is described as:

'Dev_Fix_Plan_Attribute' => {
                        'smallStringValue' => 'Development_Fix_Plan.literal.l1',
                        'longValue' => {},
                        'decimalValue' => {},
                        'displayValue' => 'Development_Fix_Plan.literal.l1',
                        'booleanValue' => {},
                        etc



continued....
                        'type' => 'smallStringValue',
                        'helperId' => '_PLvB8KHDEeSiubWmwVW87Q',
                        'timestampValue' => {},
                        'doubleValue' => '0.0',
                        'largeStringValue' => {},
                        'displayName' => 'Dev Fix Plan'

which is very nearlly what I need.  The Dev Fix Plan customised attribute is an enumrated value I think, and we are being told the index of the enumation is

Development_Fix_Plan.literal.l1

but I don't know how to look up the the real value of Development_Fix_Plan.literal.l1

I'm surprised that even the second URL did not give you the custom attributes, as it works without any issues in my environment. Did you get any attributes that are in the "rtc_ext" name space at all?

1 vote

Hello Donald:

No, I'm afraid there are no attributes in the "rtc_ext" name space at all in the second query.  Is your environment perhaps later than mine (I'm at Jazz 4.0.6 at the moment)



2 answers

Permanent link
You could use the Reportable REST API, with a query such as:
https://server:port/jazz/rpt/repository/workitem?fields=workitem/workItem[id=6460]/allExtensions/*

Reportable REST API documentation can be found here:
https://jazz.net/wiki/bin/view/Main/ReportsRESTAPI

0 votes


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

0 votes

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,019
× 369
× 233
× 137
× 35

Question asked: Jan 21 '15, 5:42 p.m.

Question was seen: 6,798 times

Last updated: Jan 23 '15, 8:36 a.m.

Confirmation Cancel Confirm