It's all about the answers!

Ask a question

How update RTC work item with enumeration list field by REST


Dmitry A. Lesin (23413166) | asked Oct 24 '14, 6:35 a.m.
Hello guys!
I found an unclear issue. I can not update an RTC work item which contains a multi value field created based on enumeration list attribute.
If I use a single enumeration, for example priority, so I can do GET request to this work item and define a real value like to:

<oslc_cm:priority rdf:resource="https://jazz.finecosoft.ru:9443/ccm/oslc/enumerations/_LbHV8FaWEeSZl8cZf7qI_w/priority/Critical"/>

In this case, I know that I will use the value in "rdf:resource" attribute to change the field value.
But what can I to do in case of multi value custom field. The value which I get with REST is like to:

<rtc_cm:com.finecosoft.components.field oslc_cm:collref="https://jazz.finecosoft.ru:9443/ccm/oslc/enumerations/_LbHV8FaWEeSZl8cZf7qI_w/enumerationList$com.finecosoft.components.enum"/>

I don't see the values which are set for this field. Please help me if it's possible to work with enumeration list by REST API.
Thank you very much in advance!

Accepted answer


permanent link
Tadeusz Janasiewicz (10549) | answered Oct 30 '14, 9:59 a.m.
Hi Dmitry,

From what I see you can use the Firebug to check how it works, see the post:
https://jazz.net/forum/questions/135858/how-to-perform-particular-action-using-rest-api-in-clm-applications

Best regards,
Tad
Dmitry A. Lesin selected this answer as the correct answer

Comments
1
Dmitry A. Lesin commented Oct 31 '14, 3:14 a.m. | edited Oct 31 '14, 3:17 a.m.

Hi Tadeusz,

Thank you for your reference! I couldn't find it earlier.
Firebug shew me such POST data which I can reproduce in my code:

additionalSaveParameters    com.ibm.team.workitem.common.internal.updateBacklinks
attributeIdentifiers    com.finecosoft.components.field
attributeValues    ["com.finecosoft.components.enum.literal.l2","com.finecosoft.components.enum.literal.l4","com.finecosoft.components.enum.literal.l6","com.finecosoft.components.enum.literal.l8"]
itemId    _mcFNcFtuEeSOSZ_ecNriAA
projectAreaItemId    _LbHV8FaWEeSZl8cZf7qI_w
sanitizeHTML    true
stateId    _uD-9gFtvEeSOSZ_ecNriAA
type    com.finecosoft.workitem.type.requestbat

We can see a correct syntax in "attributeValues", and other useful data. I will return here soon for finalizing the investigation results.


Tadeusz Janasiewicz commented Nov 02 '14, 7:54 a.m.

Hi Dmitry,

I added a simple example how use Firebug and Poster in situations like yours, please see the post:
https://jazz.net/forum/questions/166922/how-to-use-firebug-and-poster-to-find-and-test-rest-parameters-to-change-workitemss-in-rtc


Dmitry A. Lesin commented Nov 25 '14, 1:44 p.m. | edited Nov 25 '14, 1:48 p.m.

Hi Tad,
Thank you for the reference above. To update such field with HTTP request in XML format (not JSON) I performed in accordance to OSLC CM v2.0:

1. Do GET request:

URL: https://<SERVER>:9443/ccm/oslc/workitems/136?oslc_cm.properties=rtc_ext:com.finecosoft.components.field

Headers:
OSLC-Core-Version: 2.0
Accept: application/rdf+xml
Content-Type: application/rdf+xml



Dmitry A. Lesin commented Nov 25 '14, 1:47 p.m.

Current screenshot for the custom field:



Dmitry A. Lesin commented Nov 25 '14, 2:10 p.m. | edited Nov 25 '14, 2:24 p.m.
  1. Do PUT request:

    URL: the same

    Headers: the same
    and
    If-Match: 36d19b16-2364-3c38-aac6-176636921543
    This value is taken from Etag in response headers from GET request!


Dmitry A. Lesin commented Nov 25 '14, 2:15 p.m.

We can see at the next screenshot that the enumeration list is actually updated!



Dmitry A. Lesin commented Nov 25 '14, 2:16 p.m.


Dmitry A. Lesin commented Nov 25 '14, 2:18 p.m.

I believe this info could help to everybody who needs the details of updating the enumeration list fields with HTTP requests!

showing 5 of 10 show 5 more comments

Your answer


Register or to post your answer.