Creating Workitem using OSLC 2.0
Accepted answer
From my setup where creation factory is accessible through :
<oslc:creation rdf:resource="https://clm50.ibm.com/ccm/oslc/contexts/_Er238D6VEeSMB9u6bNNYlQ/workitems/task"/>I perform a POST on
https://clm50.ibm.com/ccm/oslc/contexts/_Er238D6VEeSMB9u6bNNYlQ/workitems/taskwith content type header set to :
Content-Type : application/xmland body :
<?xml version="1.0" encoding="UTF-8"?>the Task work item gets created.
<oslc_cm:ChangeRequest
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:dc="http://purl.org/dc/terms/"
xmlns:oslc_cm="http://open-services.net/xmlns/cm/1.0/" >
<dc:title>Contribute To on a REST WI</dc:title>
<dc:type rdf:resource="https://clm50.ibm.com/ccm/oslc/types/_Er238D6VEeSMB9u6bNNYlQ/task"/>
<dc:description>To check the Contributes To on a REST created Work Item</dc:description>
<dc:creator rdf:resource="https://clm50.ibm.com/jts/users/clmadmin"/>
</oslc_cm:ChangeRequest>
Notes :
a. look at the Resource Shape to understand the Required attributes during creation and supply them.
b. GET a work item and use the response to construct your body.
- remove non-required attributes and
- supply appropriate values for other attributes
hope this helps
Comments
Hi Dinesh,
Cheers, I am able to create work item with this. But this syntax is for oslc 2.0 or 1.0?
Thanks again!
glad to know that.. please accept the answer if it covered your question.
its for OSLC 2.0..
Hi Dinesh,
One more question, what is the tag for filed against in OSLC?
Hi Dinesh,
In this above answer, when I am creating a workitem, the description field is not set,
<dc:description>To check the Contributes To on a REST created Work Item</dc:description>
Any reason for this?
Sud
HI Sudipto,
are you using the header OSLC-Core-Version with a value 2.0?
If so, I suggest performing a GET on one of your work items which has some description content and look at the tag for description from the returned response.
modify your creation content accordingly.
as for the filed here is a link
https://jazz.net/wiki/bin/view/Main/ResourceOrientedWorkItemAPIv2#Attributes
which has the listing of all the attributes and
for filed against it is :
rtc_cm:filedAgainst
Hi Dinesh,
Yes, I am using OSLC 2.0
From my response, The desc field looks like:
<dcterms:description rdf:parseType="Literal"></dcterms:description> When I am tryin with "dcterms", i am getting error as " field is not bound".
Sud
Have anyone used Python package rtcclient 0.6.0 on RTC with OSLC 2.0 successfully? I got "not well-formed (invalid token)" error when I tried to get work item by (for example),
myclient = RTCClient(url, username, password, ends_with_jazz=False)
wk = myclient.getWorkitem(1643428)
. The root cause appears to be the xmltodict.parse( ) can't parse the response content without error.