It's all about the answers!

Ask a question

In RRC, how do I create an "Implemented By" link using the REST API and C#?


Andrew Trobec (49712140139) | asked Feb 10 '14, 10:07 a.m.
Hello,

I am trying to create an "Implemented By" link using the REST API in C# for an artifact in RRC to a work item in RTC.  I have referred to this post for a little guidance, but it is not very clear.

Basically what I did first was make a GET post to an artifact using the it's URL and by specifying the link type that I want:

https://server/rm/resources/_vvjWoMz8EeKAvJ3otSDu6Q?oslc_cm.properties=oslc_rm:implementedBy

This call provided me with an XML format that I copied as the body of my PUT post.  Also, thanks to the post mentioned above, this allowed me to capture the ETAG header which I then added as an "If-Match" header for for my PUT.

When trying to PUT the modified XML along with the header, I keep getting a Forbidden error with the message:

<err:detailedMessage rdf:datatype="http://www.w3.org/2001/XMLSchema#string">CRRRS6402E Content is not allowed. Content type must be application/rdf+xml (More info found at entry [3669ba3c2e64a332] in RRS server log)</err:detailedMessage>

All my headers have "Content-Type" set to "application/rdf+xml" but it makes no difference.  Along with this header I have "OSLC-Core-Version" set to "2.0", "Accept" ser to "application/rdf+xml", and the "If-Match" header mentioned above.

Am I missing something?  Is there another way to get the XML format?  The String that I am using as my request body looks as follows:

"<rdf:RDF " +
"xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\" " +
"xmlns:dcterms=\"http://purl.org/dc/terms/\" " +
"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:nodeID=\"A0\">" +
"<rdf:subject rdf:resource=\"" + _requirement.about + "\"/>" +
"<rdf:predicate rdf:resource=\"http://open-services.net/ns/rm#implementedBy\"/>" +
"<rdf:object rdf:resource=\"" + _changeRequest.about + "\"/>" +
"<rdf:type rdf:resource=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#Statement\"/>" +
"<dc:title>" + _changeRequest.identifier + ": " + _changeRequest.title + "</dc:title>" +
"</rdf:Description>" +
"</rdf:RDF>";

where _requirement is the artifact and _changeRequest is the work item that I am linking the artifact to.

Any help would be greatly appreciated!

Best regards,

Andrew

Accepted answer


permanent link
Gabriel Ruelas (1.1k13) | answered Feb 10 '14, 10:19 a.m.
Hi,
RM does not support oslc_properties for update. You should do an OSLC get to the complete RM artifact, modify the link information and do the PUT .
Andrew Trobec selected this answer as the correct answer

Comments
Andrew Trobec commented Feb 10 '14, 10:55 a.m.

@gra

Thanks for the information.  When I do the PUT, do I have to put the entire XML back again that contains the attributes and values that don't concern the link, or can I slim down the XML content and only put the link?
Do you have an example by any chance?
Regards,
Andrew


Gabriel Ruelas commented Feb 10 '14, 10:57 a.m.

Andrew, you have to put back the entire XML. Looks for examples at : https://jazz.net/library/article/1197


Andrew Trobec commented Feb 10 '14, 1:08 p.m.

Hello Gabriel, not the answer i was hoping for! Thanks for feedback, I will explore!

Your answer


Register or to post your answer.