How do I unassign all values from an enumeration list using the web APIs?
If I do PUT on my work item to https://my.rtc:9443/ccm/resource/itemName/com.ibm.team.workitem.WorkItem/123 and send a body like this, and it will unassign all values except for the one specified:
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:oslc="http://open-services.net/ns/core#"
xmlns:j.0="https://my.rtc:9443/ccm/oslc/context/_2KmWk641EeSEpKaM_mUNZL/shapes/workitems/"
xmlns:j.1="http://open-services.net/ns/cm-x#"
xmlns:dcterms="http://purl.org/dc/terms/"
xmlns:j.3="http://jazz.net/xmlns/prod/jazz/rtc/cm/1.0/"
xmlns:j.2="http://jazz.net/xmlns/prod/jazz/rtc/ext/1.0/">
<j.0:task rdf:about="https://my.rtc:9443/ccm/resource/itemName/com.ibm.team.workitem.WorkItem/123">
<j.2:customEnumList rdf:resource="https://my.rtc:9443/ccm/oslc/enumerations/_2KmWk641EeSEpKaM_mUNZL/enumerationList$customEnum/customEnum.literal.l1"/>
</j.0:task>
</rdf:RDF>
However it does not appear that I can unassign all values from the Enumeration List, although it is possible through the web UI. Does anyone know if there is a way to do this using the web APIs?
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:oslc="http://open-services.net/ns/core#"
xmlns:j.0="https://my.rtc:9443/ccm/oslc/context/_2KmWk641EeSEpKaM_mUNZL/shapes/workitems/"
xmlns:j.1="http://open-services.net/ns/cm-x#"
xmlns:dcterms="http://purl.org/dc/terms/"
xmlns:j.3="http://jazz.net/xmlns/prod/jazz/rtc/cm/1.0/"
xmlns:j.2="http://jazz.net/xmlns/prod/jazz/rtc/ext/1.0/">
<j.0:task rdf:about="https://my.rtc:9443/ccm/resource/itemName/com.ibm.team.workitem.WorkItem/123">
<j.2:customEnumList rdf:resource="https://my.rtc:9443/ccm/oslc/enumerations/_2KmWk641EeSEpKaM_mUNZL/enumerationList$customEnum/customEnum.literal.l1"/>
</j.0:task>
</rdf:RDF>
However it does not appear that I can unassign all values from the Enumeration List, although it is possible through the web UI. Does anyone know if there is a way to do this using the web APIs?
One answer
To anyone that might be interested, if you add the attribute you wish the change as an oslc.properties argument to the end of your PUT update, and do not include an element for that attribute in the body, it will remove the value.
So, for my example, I would use the URL:
https://my.rtc:9443/ccm/resource/itemName/com.ibm.team.workitem.WorkItem/123?oslc.properties=rtc_ext:customenumlist
With a body like:
<rdf:rdf xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:oslc="http://open-services.net/ns/core#"
xmlns:j.0="https://my.rtc:9443/ccm/oslc/context/_2KmWk641EeSEpKaM_mUNZL/shapes/workitems/"
xmlns:j.1="http://open-services.net/ns/cm-x#"
xmlns:dcterms="http://purl.org/dc/terms/"
xmlns:j.3="http://jazz.net/xmlns/prod/jazz/rtc/cm/1.0/"
xmlns:j.2="http://jazz.net/xmlns/prod/jazz/rtc/ext/1.0/">;
<j.0:task rdf:about="https://my.rtc:9443/ccm/resource/itemName/com.ibm.team.workitem.WorkItem/123">;
</j.0:task>
</rdf:rdf>
So, for my example, I would use the URL:
https://my.rtc:9443/ccm/resource/itemName/com.ibm.team.workitem.WorkItem/123?oslc.properties=rtc_ext:customenumlist
With a body like:
<rdf:rdf xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:oslc="http://open-services.net/ns/core#"
xmlns:j.0="https://my.rtc:9443/ccm/oslc/context/_2KmWk641EeSEpKaM_mUNZL/shapes/workitems/"
xmlns:j.1="http://open-services.net/ns/cm-x#"
xmlns:dcterms="http://purl.org/dc/terms/"
xmlns:j.3="http://jazz.net/xmlns/prod/jazz/rtc/cm/1.0/"
xmlns:j.2="http://jazz.net/xmlns/prod/jazz/rtc/ext/1.0/">;
<j.0:task rdf:about="https://my.rtc:9443/ccm/resource/itemName/com.ibm.team.workitem.WorkItem/123">;
</j.0:task>
</rdf:rdf>
Comments
Ralph Schoon
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER Feb 26 '15, 7:18 a.m.I doubt that I can see the correct XML. It might be useful to add a screenshot instead. I think you have to return the enumeration list with no literals at all.
Myles F
Feb 26 '15, 11:48 a.m.Thanks for the reply Ralph. Do you know how I can send an enumeration list with no literals at all?
If I don't send the enumeration list attribute element at all in the XML body, no update happens (it keeps the previous values) for that attribute.
I have tried sending the following as elements in the XML body:
<j.2:customenumlist rdf:resource=""/>
and
<j.2:customenumlist />
but that causes an error when I send the PUT
Myles F
Feb 26 '15, 4:25 p.m.I've determined that if I add ?oslc.properties=rtc_ext:customenumlist to the end of the PUT url, and do not include an element for that attribute in the body, it will remove the value.
However, once it's removed, I can not assign a new value using the PUT. If I try to include that element again in the next PUT body, I get this error
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:oslc="http://open-services.net/ns/core#" >
<rdf:Description rdf:nodeID="A0">
<oslc:message>assertion failed: </oslc:message>
<oslc:statusCode>500</oslc:statusCode>
<rdf:type rdf:resource="http://open-services.net/ns/core#Error"/>
</rdf:Description>
</rdf:RDF>
So I can only change the value if the attribute is already assigned. This seems like it might be a bug to me.
Myles F
Feb 27 '15, 5:07 p.m.I've answered this question, and will open another one for the new issue I encountered and mentioned in the comment above.