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:
or
and the title was changed but the enumeration values did not.
All the enums:
[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
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>
<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">
</oslc_cm:Collection>
<rtc_cm:Literal rdf:resource="https://localhost:9443/ccm/oslc/enumerations/_ZvMmj2DREeSnNOlM1JrDkA/enumerationList$related_projects/Project%201">
</rtc_cm:Literal>
<dc:identifier>
</dc:identifier>
related_projects.literal.l1
<dc:title>
</dc:title>
Project 1
<rtc_cm:iconUrl />
<rtc_cm:Literal rdf:resource="https://localhost:9443/ccm/oslc/enumerations/_ZvMmj2DREeSnNOlM1JrDkA/enumerationList$related_projects/Project%202">
</rtc_cm:Literal>
<dc:identifier>
</dc:identifier>
related_projects.literal.l2
<dc:title>
</dc:title>
Project 2
<rtc_cm:iconUrl />
<rtc_cm:Literal rdf:resource="https://localhost:9443/ccm/oslc/enumerations/_ZvMmj2DREeSnNOlM1JrDkA/enumerationList$related_projects/Project%203">
</rtc_cm:Literal>
<dc:identifier>
</dc:identifier>
related_projects.literal.l3
<dc:title>
</dc:title>
Project 3
<rtc_cm:iconUrl />
<rtc_cm:Literal rdf:resource="https://localhost:9443/ccm/oslc/enumerations/_ZvMmj2DREeSnNOlM1JrDkA/enumerationList$related_projects/Project%204">
</rtc_cm:Literal>
<dc:identifier>
</dc:identifier>
related_projects.literal.l4
<dc:title>
</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
Comments
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.
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.
Comments
Donald Nong
Nov 18 '14, 1:11 a.m.Tadeusz Janasiewicz
Nov 18 '14, 2:27 a.m.Tadeusz Janasiewicz
Nov 18 '14, 3:27 a.m.