It's all about the answers!

Ask a question

OSLC: How to remove subscribers with OSLC?


1
2
ryosuke oka (17994648) | asked Jan 07 '13, 11:06 p.m.
I was able to update/modify a subscriber using PUT method but can not figure out how to remove a users.
I could remove a user by removing the userID if there is more than 1 users in subscription but can not remove a last subscribed user.

When I remove a user ID like below, I will get "500 Internal Server Error" with "Invalid Contributor User Id. Contributor userId must not be empty" message.

What is a proper way to specify no subscription user for a work Item update?

DATA for PUT:
<rtc_cm:subscribers rdf:resource="https://win-zdjhomb8uyp:9443/jts/users/ "/>
 ↓
Response
Status: 500 Internal Server Error
Data:
<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>Invalid Contributor User Id. Contributor userId must not be empty</oslc:message>
    <oslc:statusCode>500</oslc:statusCode>
    <rdf:type rdf:resource="http://open-services.net/ns/core#Error"/>
  </rdf:Description>
</rdf:RDF>



============ To modify subscriber (working OK with REST client) ==================
URL
https://win-zdjhomb8uyp:9443/ccm/resource/itemName/com.ibm.team.workitem.WorkItem/1
Method - PUT
Headers
Content-Type: application/rdf+xml
OSLC-Core-Version: 2.0
Accept: application/rdf+xml

Data
<rdf:RDF
  xmlns:oslc_pl="http://open-services.net/ns/pl#"
  xmlns:rtc_ext="http://jazz.net/xmlns/prod/jazz/rtc/ext/1.0/"
  xmlns:rtc_cm="http://jazz.net/xmlns/prod/jazz/rtc/cm/1.0/"
  xmlns:dcterms="http://purl.org/dc/terms/"
  xmlns:oslc_cmx="http://open-services.net/ns/cm-x#"
  xmlns:acp="http://jazz.net/ns/acp#"
  xmlns:oslc_cm="http://open-services.net/ns/cm#"
  xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
  xmlns:oslc="http://open-services.net/ns/core#">
  <oslc_cm:ChangeRequest rdf:about="https://win-zdjhomb8uyp:9443/ccm/resource/itemName/com.ibm.team.workitem.WorkItem/1">
 
<rtc_cm:subscribers rdf:resource="https://win-zdjhomb8uyp:9443/jts/users/user1"/>

  </oslc_cm:ChangeRequest>
</rdf:RDF>
=====================================


Comments
Mike Shkolnik commented Aug 21 '13, 5:33 p.m. | edited Aug 21 '13, 6:40 p.m.

is it possible to unsubscribe "{currentUser}" from a work item in a single HTTP command?

Accepted answer


permanent link
Jan Wloka (4161) | answered Jan 10 '13, 3:48 a.m.
JAZZ DEVELOPER
Individual properties of a change request can be modified with the "?oslc_cm.properties" URL parameter. In case of changing subscribers you would do the following:

GET https://myhost:9443/jazz/resource/itemName/com.ibm.team.workitem.WorkItem/1?oslc_cm.properties=rtc_cm:subscribers
OSLC-Core-Version: 2.0  
Accept: application/rdf+xml  

RTC returns the following RDF content:
<rdf:RDF
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:oslc_cm="http://open-services.net/ns/cm#"
    xmlns:rtc_cm="http://jazz.net/xmlns/prod/jazz/rtc/cm/1.0/" > 
  <rdf:Description rdf:about="https://myhost:9443/jazz/resource/itemName/com.ibm.team.workitem.WorkItem/1?oslc_cm.properties=rtc_cm:subscribers">
    <rdf:type rdf:resource="http://open-services.net/ns/cm#ChangeRequest"/>
    <rtc_cm:subscribers rdf:resource="https://myhost:9443/jazz/users/volt"/>
    <rtc_cm:subscribers rdf:resource="https://myhost:9443/jazz/users/ADMIN"/>
  </rdf:Description>
</rdf:RDF>
Remove all the subscribers from the RDF you want to unsubscribe and PUT the resource back to the server. In case you want to remove all subscribers your resource would look like:
<rdf:RDF
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:oslc_cm="http://open-services.net/ns/cm#"
    xmlns:rtc_cm="http://jazz.net/xmlns/prod/jazz/rtc/cm/1.0/" > 
  <rdf:Description rdf:about="https://myhost:9443/jazz/resource/itemName/com.ibm.team.workitem.WorkItem/1?oslc_cm.properties=rtc_cm:subscribers">
    <rdf:type rdf:resource="http://open-services.net/ns/cm#ChangeRequest"/>
  </rdf:Description>
</rdf:RDF>

PUT https://myhost:9443/jazz/resource/itemName/com.ibm.team.workitem.WorkItem/1?oslc_cm.properties=rtc_cm:subscribers 
OSLC-Core-Version: 2.0   
content-type: application/rdf+xml 

HTH,
Jan.
ryosuke oka selected this answer as the correct answer

Comments
ryosuke oka commented Jan 10 '13, 4:17 a.m.

Hi Jan.
It worked! Great! Thank you for your answer.

2 other answers



permanent link
Jan Wloka (4161) | answered Jan 09 '13, 4:26 p.m.
JAZZ DEVELOPER
Hi there, I'm not sure what happened to your RDF content but mine looks a little different. When I do a GET call with the following parameters:

GET https://myhost:9443/jazz/resource/itemName/com.ibm.team.workitem.WorkItem/1 
OSLC-Core-Version: 2.0 
Accept: application/rdf+xml 

RTC returns the following RDF content:

<?xml version="1.0"?>
<rdf:RDF 
  xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" 
  xmlns:acp="http://jazz.net/ns/acp#" 
  xmlns:oslc="http://open-services.net/ns/core#" 
  xmlns:oslc_cmx="http://open-services.net/ns/cm-x#" 
  xmlns:dcterms="http://purl.org/dc/terms/" 
  xmlns:oslc_cm="http://open-services.net/ns/cm#" 
  xmlns:oslc_pl="http://open-services.net/ns/pl#" 
  xmlns:rtc_cm="http://jazz.net/xmlns/prod/jazz/rtc/cm/1.0/" 
  xmlns:rtc_ext="http://jazz.net/xmlns/prod/jazz/rtc/ext/1.0/">
  <rdf:Description rdf:about="https://myhost:9443/jazz/resource/itemName/com.ibm.team.workitem.WorkItem/1">
    <acp:accessControl rdf:resource="https://myhost:9443/jazz/oslc/access-control/_39WjkEqcEeKMdtrex543ww"/>
    <dcterms:contributor rdf:resource="https://myhost:9443/jazz/users/unassigned"/>
    <dcterms:created rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2012-06-23T12:00:53.026Z</dcterms:created>
    <dcterms:creator rdf:resource="https://myhost:9443/jazz/users/ADMIN"/>
    <dcterms:description rdf:parseType="Literal"/>
    <dcterms:identifier rdf:datatype="http://www.w3.org/2001/XMLSchema#string">1</dcterms:identifier>
    <dcterms:modified rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2013-01-09T18:22:57.086Z</dcterms:modified>
    <dcterms:subject rdf:datatype="http://www.w3.org/2001/XMLSchema#string"/>
    <dcterms:title rdf:parseType="Literal">work item on this plan</dcterms:title>
    <dcterms:type rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Task</dcterms:type>
    <oslc:discussedBy rdf:resource="https://myhost:9443/jazz/oslc/workitems/_53swYEqcEeKMdtrex543ww/rtc_cm:comments"/>
    <oslc:instanceShape rdf:resource="https://myhost:9443/jazz/oslc/shapes/workitems/_53swYEqcEeKMdtrex543ww"/>
    <oslc:serviceProvider rdf:resource="https://myhost:9443/jazz/oslc/contexts/_39WjkEqcEeKMdtrex543ww/workitems/services"/>
    <oslc:shortTitle rdf:parseType="Literal">Task 1</oslc:shortTitle>
    <oslc_cm:approved rdf:datatype="http://www.w3.org/2001/XMLSchema#boolean">false</oslc_cm:approved>
    <oslc_cm:closed rdf:datatype="http://www.w3.org/2001/XMLSchema#boolean">false</oslc_cm:closed>
    <oslc_cm:fixed rdf:datatype="http://www.w3.org/2001/XMLSchema#boolean">false</oslc_cm:fixed>
    <oslc_cm:inprogress rdf:datatype="http://www.w3.org/2001/XMLSchema#boolean">false</oslc_cm:inprogress>
    <oslc_cm:reviewed rdf:datatype="http://www.w3.org/2001/XMLSchema#boolean">false</oslc_cm:reviewed>
    <oslc_cm:status rdf:datatype="http://www.w3.org/2001/XMLSchema#string">New</oslc_cm:status>
    <oslc_cm:verified rdf:datatype="http://www.w3.org/2001/XMLSchema#boolean">false</oslc_cm:verified>
    <oslc_cmx:priority rdf:resource="https://myhost:9443/jazz/oslc/enumerations/_39WjkEqcEeKMdtrex543ww/priority/priority.literal.l01"/>
    <oslc_cmx:project rdf:resource="https://myhost:9443/jazz/oslc/projectareas/_39WjkEqcEeKMdtrex543ww"/>
    <oslc_cmx:severity rdf:resource="https://myhost:9443/jazz/oslc/enumerations/_39WjkEqcEeKMdtrex543ww/severity/severity.literal.l3"/>
    <oslc_pl:schedule rdf:resource="https://myhost:9443/jazz/oslc/workitems/_53swYEqcEeKMdtrex543ww/schedule"/>
    <rdf:type rdf:resource="http://open-services.net/ns/cm#ChangeRequest"/>
    <rtc_cm:correctedEstimate rdf:datatype="http://www.w3.org/2001/XMLSchema#long"/>
    <rtc_cm:estimate rdf:datatype="http://www.w3.org/2001/XMLSchema#long"/>
    <rtc_cm:filedAgainst rdf:resource="https://myhost:9443/jazz/resource/itemOid/com.ibm.team.workitem.Category/_5i_EoEqcEeKMdtrex543ww"/>
    <rtc_cm:modifiedBy rdf:resource="https://myhost:9443/jazz/users/ADMIN"/>
    <rtc_cm:plannedFor rdf:resource="https://myhost:9443/jazz/oslc/iterations/_4B0M0UqcEeKwhuBpkPFD3A"/>
    <rtc_cm:progressTracking rdf:resource="https://myhost:9443/jazz/oslc/workitems/_53swYEqcEeKMdtrex543ww/progressTracking"/>
    <rtc_cm:repository rdf:resource="https://myhost:9443/jazz/oslc/repository"/>
    <rtc_cm:resolvedBy rdf:resource="https://myhost:9443/jazz/users/unassigned"/>
    <rtc_cm:state rdf:resource="https://myhost:9443/jazz/oslc/workflows/_39WjkEqcEeKMdtrex543ww/states/com.ibm.team.workitem.taskWorkflow/1"/>
    <rtc_cm:subscribers rdf:resource="https://myhost:9443/jazz/users/ADMIN"/>
    <rtc_cm:subscribers rdf:resource="https://myhost:9443/jazz/users/volt"/>
    <rtc_cm:teamArea rdf:resource="https://myhost:9443/jazz/oslc/teamareas/_5TM8MEqcEeKMdtrex543ww"/>
    <rtc_cm:timeSheet rdf:resource="https://myhost:9443/jazz/oslc/workitems/_53swYEqcEeKMdtrex543ww/rtc_cm:timeSheet"/>
    <rtc_cm:timeSpent rdf:datatype="http://www.w3.org/2001/XMLSchema#long"/>
    <rtc_cm:type rdf:resource="https://myhost:9443/jazz/oslc/types/_39WjkEqcEeKMdtrex543ww/task"/>
    <rtc_ext:archived rdf:datatype="http://www.w3.org/2001/XMLSchema#boolean">false</rtc_ext:archived>
    <rtc_ext:contextId>_39WjkEqcEeKMdtrex543ww</rtc_ext:contextId>
  </rdf:Description>
</rdf:RDF>

		

PUTting the same resource back to the server, just with a removed subscriber entry will remove it from the work item. For example, when you remove the entry
<rtc_cm:subscribers rdf:resource="https://myhost:9443/jazz/users/ADMIN"/>
		
from the RDF and use the following REST call, the user ADMIN will no longer be subscribed:

PUT https://myhost:9443/jazz/resource/itemName/com.ibm.team.workitem.WorkItem/1 
OSLC-Core-Version: 2.0  
content-type: application/rdf+xml 

HTH,
Jan.

Comments
Millard Ellingsworth commented Jan 09 '13, 6:35 p.m.
FORUM ADMINISTRATOR / JAZZ DEVELOPER

Jan, does this same approach work if removing the last subscriber? I think that was the main concern of the poster is that the last subscriber couldn't be removed this way. If you repeat your example, removing the other subscriber entry (so now there are no rtc_cm:subscriber entries), would you get the error or just no longer have any subscribers?


permanent link
Millard Ellingsworth (2.5k12431) | answered Jan 08 '13, 3:22 p.m.
FORUM ADMINISTRATOR / JAZZ DEVELOPER
I've asked the developer who has worked in this area most recently to have a look. Until he gets to it, perhaps the discussion in these work items may help:

https://jazz.net/jazz/web/projects/Rational%20Team%20Concert#action=com.ibm.team.workitem.viewWorkItem&id=134520
https://jazz.net/jazz/web/projects/Rational%20Team%20Concert#action=com.ibm.team.workitem.viewWorkItem&id=210630
https://jazz.net/jazz/web/projects/Rational%20Team%20Concert#action=com.ibm.team.workitem.viewWorkItem&id=193651

Some of the related changes went into RTC 4.x. Since you have parts of this working, I'm assuming you are using the OSLC v2 and at least RTC 4.0.

Comments
ryosuke oka commented Jan 08 '13, 11:37 p.m.

Hi Millard, Thank you for head up. Yes, I use v4.0.1 and OSLC v2.
Please let me know once you find a way to remove a last subscriber in a work Item.


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.