It's all about the answers!

Ask a question

How update RTC work item with enumeration list field by REST

Dmitry A. Lesin (24826696) | 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=""/>

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="$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 (120149) | 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:

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

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:

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:

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

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.