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

How to update reference types using OSLC Change Request XML format?

I would like to update Enumeration List attributes using the REST API based on XML format.

I know how to do that using the JSON format see the [1], but in case of XML format even when I try to get values of this attribute I get only the info about the reference type without the values:

Get Enumeration List values


I found an example how to add a link which is also a reference type [2], but it does not work.


I used a request like this one:

<oslc_cm:ChangeRequest xmlns:rtc_cm="https://jazz.net/xmlns/prod/jazz/rtc/cm/1.0/" xmlns:oslc_disc="http://open-services.net/xmlns/discovery/1.0/" xmlns:dc="http://purl.org/dc/terms/" xmlns:opensearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:jp="https://jazz.net/xmlns/prod/jazz/presentation/1.0/" xmlns:jd="https://jazz.net/xmlns/prod/jazz/discovery/1.0/" xmlns:oslc_cm="http://open-services.net/xmlns/cm/1.0/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:calm="https://jazz.net/xmlns/prod/jazz/calm/1.0/">
  <dc:title>Changed title</dc:title>
  <rtc_cm:related_projects_attribute oslc_cm:collref="https://localhost:9443/ccm/oslc/enumerations/_ZvMmj2DREeSnNOlM1JrDkA/enumerationList$related_projects/Project%202" />
</oslc_cm:ChangeRequest>

or

<oslc_cm:ChangeRequest xmlns:rtc_cm="https://jazz.net/xmlns/prod/jazz/rtc/cm/1.0/" xmlns:oslc_disc="http://open-services.net/xmlns/discovery/1.0/" xmlns:dc="http://purl.org/dc/terms/" xmlns:opensearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:jp="https://jazz.net/xmlns/prod/jazz/presentation/1.0/" xmlns:jd="https://jazz.net/xmlns/prod/jazz/discovery/1.0/" xmlns:oslc_cm="http://open-services.net/xmlns/cm/1.0/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:calm="https://jazz.net/xmlns/prod/jazz/calm/1.0/">
  <dc:title>Hello!</dc:title>
  <rtc_cm:related_projects_attribute oslc_cm:collref="https://localhost:9443/ccm/oslc/enumerations/_ZvMmj2DREeSnNOlM1JrDkA/enumerationList$related_projects">
    <rtc_cm:Literal rdf:resource="https://localhost:9443/ccm/oslc/enumerations/_ZvMmj2DREeSnNOlM1JrDkA/enumerationList$related_projects/Project%202"/>
  </rtc_cm:related_projects_attribute>
</oslc_cm:ChangeRequest>

and the title was changed but the enumeration values did not.

All the enums:

<?xml version="1.0" encoding="UTF-8" ?>
 <oslc_cm:Collection oslc_cm:totalCount="4">
 <rtc_cm:Literal rdf:resource="https://localhost:9443/ccm/oslc/enumerations/_ZvMmj2DREeSnNOlM1JrDkA/enumerationList$related_projects/Project%201">
<dc:identifier>
related_projects.literal.l1
</dc:identifier>
<dc:title>
Project 1
</dc:title>
<rtc_cm:iconUrl />
 </rtc_cm:Literal>
 <rtc_cm:Literal rdf:resource="https://localhost:9443/ccm/oslc/enumerations/_ZvMmj2DREeSnNOlM1JrDkA/enumerationList$related_projects/Project%202">
<dc:identifier>
related_projects.literal.l2
</dc:identifier>
<dc:title>
Project 2
</dc:title>
<rtc_cm:iconUrl />
 </rtc_cm:Literal>
 <rtc_cm:Literal rdf:resource="https://localhost:9443/ccm/oslc/enumerations/_ZvMmj2DREeSnNOlM1JrDkA/enumerationList$related_projects/Project%203">
<dc:identifier>
related_projects.literal.l3
</dc:identifier>
<dc:title>
Project 3
</dc:title>
<rtc_cm:iconUrl />
 </rtc_cm:Literal>
 <rtc_cm:Literal rdf:resource="https://localhost:9443/ccm/oslc/enumerations/_ZvMmj2DREeSnNOlM1JrDkA/enumerationList$related_projects/Project%204">
<dc:identifier>
related_projects.literal.l4
</dc:identifier>
<dc:title>
Project 4
</dc:title>
<rtc_cm:iconUrl />
 </rtc_cm:Literal>
 </oslc_cm:Collection>


[1] https://jazz.net/forum/questions/166922/how-to-use-firebug-and-poster-to-find-and-test-rest-parameters-to-change-workitemss-in-rtc
[2] https://jazz.net/wiki/bin/view/Main/ResourceOrientedWorkItemAPIv2#Adding_Links_to_a_Work_Item

1 vote

Comments

I cannot figure out why the response looks different in my own environment. What's the RTC version that you're using?
In my test, for a enumeration list attribute, there are more than one entries in the WI GET response if more than one values are selected for the attribute. And the URI for the enumeration is complete (your one is referenced to the enumeration type, not value). Also the attribute is in the <rtc_ext> namespace given that it's a custom attribute.

Hi Donald,

I am using RTC 4.0.7 and this attribute is a custom Enumeration List with 4 different values. From what I noticed only this enumeration attribute is shown as a reference to the type, maybe there is a way to change it?
Definition of this attribute:

Custome attribute, Enumeration List
Could you please share with me how looks your GET request?

I also tried the solution mentioned here:

https://jazz.net/forum/questions/62917/is-it-possible-to-update-a-collection-via-oslc-rest-calls

But it does not work in my case.

FYI
@dlesin @dlesin2 @betasharko


Accepted answer

Permanent link
 Using OSLC CM v2.0 will let you easily to update - For more details refer to this article and wiki

https://jazz.net/library/article/1001
https://jazz.net/wiki/bin/view/Main/WorkItemAPIsForOSLCCM20
Tadeusz Janasiewicz selected this answer as the correct answer

0 votes

Comments

Hi Sandeep,

Thanks, in fact when I used GET Headers:

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


I got all the attributes' values and then I was able to use this response to modify the original Work Item using PUT with additional Header entry:

If-Match: ec781968-c722-3d81-861b-27d60037cbba

Thanks!
Tad


2 other answers

Permanent link
Hi Tadeusz,
I figured out why you got a different response from mine - you missed the "OSLC-Core-Version: 2.0" request header. Or did you intentionally choose OSLC 1.0?
Once you add the header, your response should look different. It should then be easy to follow the steps outlined in the article that Sandeep posted, to update the work item.

1 vote


Permanent link
Maybe this article helps:

https://jazz.net/library/article/821

0 votes

Comments

Hi Georg,

I am not sure how Java API can help here, but thank you!

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
× 479

Question asked: Nov 17 '14, 5:56 a.m.

Question was seen: 5,405 times

Last updated: Nov 24 '14, 9:24 a.m.

Confirmation Cancel Confirm