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: 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> 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:title>
Project 1
<rtc_cm:iconUrl />
<rtc_cm:Literal rdf:resource="https://localhost:9443/ccm/oslc/enumerations/_ZvMmj2DREeSnNOlM1JrDkA/enumerationList$related_projects/Project%202">
<dc:identifier>
related_projects.literal.l2
<dc:title>
Project 2
<rtc_cm:iconUrl />
<rtc_cm:Literal rdf:resource="https://localhost:9443/ccm/oslc/enumerations/_ZvMmj2DREeSnNOlM1JrDkA/enumerationList$related_projects/Project%203">
<dc:identifier>
related_projects.literal.l3
<dc:title>
Project 3
<rtc_cm:iconUrl />
<rtc_cm:Literal rdf:resource="https://localhost:9443/ccm/oslc/enumerations/_ZvMmj2DREeSnNOlM1JrDkA/enumerationList$related_projects/Project%204">
<dc:identifier>
related_projects.literal.l4
<dc:title>
Project 4
<rtc_cm:iconUrl />
[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 |
Accepted answer
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
Comments Hi Sandeep,
|
2 other answers
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. |
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.
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:
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