It's all about the answers!

Ask a question

How to find custom attribute values in Reportable REST API output, limit output, and decode coded information


Michael Taylor (8865561) | asked Jun 21 '13, 10:30 a.m.

For background of my overall objective, please reference:

============================================

   https://jazz.net/forum/questions/116952/use-reportable-rest-api-to-obtain-child-work-item-attributes-based-on-parent-and-child-attributes

Specific background:

================

   In an attempt to achieve the overall objective, I am running the following statement:

      https://<server:port>/ccm/rpt/repository/workitem?fields=workitem/workItem/(id|summary|state/(name|group)|parent/*|children/*|customAttributes/*)

It gives output like the following:

- <w<workItem>

  <id>23</id>

  <summary>(IT45107) CM 102 - CPRO Enhancement: stop placing cases into the flow with deceased NCP's</summary>

- <state>

  <name>New</name>

  <group>open</group>

  </state>

  <parent />

- <children>

  <uniqueId>335be4668793f1cf99857a9bdf376b45</uniqueId>

  <stateId>_3FhCsLKREeKGFqpUni6-Kw</stateId>

  <itemId>__yc0ELKFEeKEModREAEZbg</itemId>

  <contextId>_1iLsQK3yEeKjWoswhs7PZg</contextId>

  <modified>2013-05-01T15:03:51.131-0400</modified>

  <predecessor>_H-RmBLKGEeKGFqpUni6-Kw</predecessor>

  <id>25</id>

  <resolutionDate>2013-05-01T13:39:50.450-0400</resolutionDate>

  <summary>(IT45107) CM 102 - CPRO Enhancement: BATCH_AGP_REFERRAL.PKB</summary>

  <creationDate>2013-05-01T13:39:50.450-0400</creationDate>

  <dueDate />

  <description>(IT45107) CM 102 - CPRO Enhancement:</description>

  <workflowSurrogate />

  <tags />

  <duration>-1</duration>

  <timeSpent>-1</timeSpent>

  <correctedEstimate>-1</correctedEstimate>

  <modifiedBy />

  <creator />

  <owner />

  <category />

  <comments />

  <customAttributes />

  <customAttributes />

  <subscriptions />

  <projectArea />

  <resolver />

  <target />

  <foundIn />

  <stringExtensions />

  <bigDecimalExtensions />

  <dayModified>2013-04-30T20:00:00.000-0400</dayModified>

  <commentCount>1</commentCount>

  <subscriberCount>1</subscriberCount>

  <state />

  <type />

  <severity />

  <priority />

  <parent />

  <allExtensions />

  <allExtensions />

  <formattedSummary>(IT45107) CM 102 - CPRO Enhancement: BATCH_AGP_REFERRAL.PKB</formattedSummary>

  <formattedDescription>(IT45107) CM 102 - CPRO Enhancement:</formattedDescription>

  <stringComplexity />

  <integerComplexity />

  <floatComplexity />

  <longComplexity />

  <doubleComplexity />

  </children>

- <children>

  <uniqueId>0d938852163179b57add45938929357f</uniqueId>

  <stateId>_W4Y_crKHEeKGFqpUni6-Kw</stateId>

  <itemId>_m_B9wLKFEeKEModREAEZbg</itemId>

  <contextId>_1iLsQK3yEeKjWoswhs7PZg</contextId>

  <modified>2013-05-01T13:48:40.039-0400</modified>

  <predecessor>_xqNHBbKFEeKGFqpUni6-Kw</predecessor>

<id>24</id>

</workItem>

- <workItem>

  <id>25</id>

  <summary>(IT45107) CM 102 - CPRO Enhancement: BATCH_AGP_REFERRAL.PKB</summary>

- <state>

  <name>Accepted / Updated</name>

  <group>closed</group>

  </state>

- <parent>

  <uniqueId>1e3794c9eadf746c50d5ee7db0c6a551</uniqueId>

  <stateId>_lroxXrKHEeKGFqpUni6-Kw</stateId>

  <itemId>_zNQDkLKEEeKEModREAEZbg</itemId>

  <contextId>_1iLsQK3yEeKjWoswhs7PZg</contextId>

  <modified>2013-05-01T13:50:19.365-0400</modified>

  <predecessor>_Kn_2wbKFEeKGFqpUni6-Kw</predecessor>

  <id>23</id>

  <resolutionDate />

  <summary>(IT45107) CM 102 - CPRO Enhancement: stop placing cases into the flow with deceased NCP's</summary>

  <creationDate>2013-05-01T13:32:58.702-0400</creationDate>

  <dueDate />

  <description>Email from the user describing the requested change...</description>

  <workflowSurrogate />

  <tags />

  <duration>-1</duration>

  <timeSpent>-1</timeSpent>

  <correctedEstimate>-1</correctedEstimate>

  <modifiedBy />

  <creator />

  <owner />

  <category />

  <subscriptions />

  <projectArea />

  <resolver />

  <target />

  <foundIn />

  <dayModified>2013-04-30T20:00:00.000-0400</dayModified>

  <commentCount>0</commentCount>

  <subscriberCount>1</subscriberCount>

  <state />

  <type />

  <severity />

  <priority />

  <parent />

  <children />

  <children />

  <children />

  <children />

  <children />

  <children />

  <children />

  <formattedSummary>(IT45107) CM 102 - CPRO Enhancement: stop placing cases into the flow with deceased NCP's</formattedSummary>

  <formattedDescription>Email from the user describing the requested change...</formattedDescription>

  <stringComplexity />

  <integerComplexity />

  <floatComplexity />

  <longComplexity />

  <doubleComplexity />

  </parent>

- <customAttributes>

  <uniqueId>fe26317191e14ee011612e125e611a31</uniqueId>

  <stateId>_zz8gRLHUEeKUr_CvpuH8pg</stateId>

  <itemId>_c--0JLGnEeKUr_CvpuH8pg</itemId>

  <contextId>_1iLsQK3yEeKjWoswhs7PZg</contextId>

  <modified>2013-04-30T16:30:34.274-0400</modified>

  <identifier>MICSES_Source_File_CI_Name</identifier>

  <attributeType>smallString</attributeType>

  <builtIn>false</builtIn>

  <modifiedBy />

  <projectArea />

  </customAttributes>

- <customAttributes>

  <uniqueId>cc173f0b0fcdceecd1f2e5d0c8327f28</uniqueId>

  <stateId>_xWeaPbKCEeKGFqpUni6-Kw</stateId>

  <itemId>_xWBuR7KCEeKGFqpUni6-Kw</itemId>

  <contextId>_1iLsQK3yEeKjWoswhs7PZg</contextId>

  <modified>2013-05-01T13:15:50.193-0400</modified>

  <identifier>MICSES_Source_file_CI_Version_dec</identifier>

  <attributeType>decimal</attributeType>

  <builtIn>false</builtIn>

  <modifiedBy />

  <projectArea />

  </customAttributes>

  </workItem>

- <workItem>

  <id>26</id>

 

Specific Questions

================

1)      How do I use the Reportable REST API to return the actual value of the custom attributes “MICSES_Source_File_CI_Name” and “MICSES_Source_file_CI_Version_dec”?

2)      Is there a way to ask the Reportable REST API to only return the fields I care about?  (id, planned for, state, parent, child, MICSES_Source_File_CI_Name, MICSES_Source_file_CI_Version_dec)  It seems that the output is providing a lot more information than that.

3)      Do I need to worry about some of the coded values (like <itemId>_xWBuR7KCEeKGFqpUni6-Kw</itemId>)?  If yes, how do I decode those?

Accepted answer


permanent link
Alanna Zito (1.3k3) | answered Jun 21 '13, 2:27 p.m.
JAZZ DEVELOPER
edited Jun 21 '13, 3:44 p.m.
Hi Michael,

Some answers to your questions in bold, below:

1)      How do I use the Reportable REST API to return the actual value of the custom attributes “MICSES_Source_File_CI_Name” and “MICSES_Source_file_CI_Version_dec”?


As you've found out, the workitem/customAttributes element doesn't return the values of those attributes; it returns metadata about the custom attributes that apply to this work item (e.g., the attribute id).  To get the value of a custom attribute, look at the elements workitem/<type>Extensions (e.g., workitem/stringExtensions for custom attributes of type string).  The custom values are stored as (key, value) pairs, where the key is the identifier of the custom attribute. So, you might use a fields argument like this:

fields=workitem/workItem/stringExtensions[key='MICSES_Source_File_CI_NameMICSES_Source_File_CI_NameMICSES_Source_File_CI_NameMICSES_Source_File_CI_NameMICSES_Source_File_CI_Name']/value

2)      Is there a way to ask the Reportable REST API to only return the fields I care about?  (id, planned for, state, parent, child, MICSES_Source_File_CI_Name, MICSES_Source_file_CI_Version_dec)  It seems that the output is providing a lot more information than that.

You're getting a lot of data in your output because of field arguments like "children/*", which is returning all the child attributes of all the children for that work item.  If you only want certain fields from the children, you need to specify them.  Have you looked at using a reporting tool like Rational Publishing Engine?  It would make it much easier to create reports based on the reportable REST API, since it can calculate the fields argument based on the data needed for the report (instead of you figuring out the URL by hand).

3)      Do I need to worry about some of the coded values (like <itemId>_xWBuR7KCEeKGFqpUni6-KwitemId>)?  If yes, how do I decode those?

I'm not sure what you mean by coded - the <itemId> is the unique UUID of the item, and is not meant to be readable.


Michael Taylor selected this answer as the correct answer

Comments
Michael Taylor commented Jun 21 '13, 4:47 p.m.

Thanks.

So for #1, I access the custom string value like this (I assume I don't have to repeat the name of the field more than once)?

   fields=workitem/workItem/stringExtensions[key='MICSES_Source_File_CI_Name']/value

How would I access a custom decimal field (I assume it's different that stringExtensions)? 

Is there a good reference to use for this kind of information?


Michael Taylor commented Jun 21 '13, 4:48 p.m.

Regarding #2, I'm trying to get this data loaded into an Oracle table for legacy system processing.  Would a reporting tool like RPE be good for that or is the REST API XML output better for that?

Regarding #3, is there any reason I would ever need to use the UUID?  For example, to like or reference another attribute or value the UUID points to?


Michael Taylor commented Jun 23 '13, 8:28 p.m.

I have made additional progress in parallel with the last clarification questions I asked in these comments.  I also needed to retrieve a custom decimal field and I assume the bigDecimalExtensions is the way to do it.



Michael Taylor commented Jun 23 '13, 8:28 p.m.

FYI - filtering questions are in-progress via this question:

      https://jazz.net/forum/questions/117377/how-to-filter-rtc-reportable-rest-api-output-based-on-multiple-criteria


Alanna Zito commented Jun 24 '13, 11:54 a.m.
JAZZ DEVELOPER

"So for #1, I access the custom string value like this (I assume I don't have to repeat the name of the field more than once)?"

Yes - sorry, that's some bad cut and paste on my part - your URL looks right.

"is there any reason I would ever need to use the UUID?"

You might need to use the UUID as a filter in some cases where you can't use the name (e.g., for types where the name is not unique); but in general, you probably don't need it very often.




Michael Taylor commented Jun 24 '13, 1:39 p.m.

Thanks.  Will the UUID's for an element ever change?


Alanna Zito commented Jun 24 '13, 1:47 p.m.
JAZZ DEVELOPER

No, UUIDs never change - they're set when the element is created.


Michael Taylor commented Jun 24 '13, 1:52 p.m.

Thanks.  Does that mean the UUID is set when the item is created via the RTC application?


Alanna Zito commented Jun 24 '13, 2:10 p.m.
JAZZ DEVELOPER

Yes - the application sets the UUID when the element is created - it's not something the user can change.

showing 5 of 10 show 5 more comments

Your answer


Register or to post your answer.