It's all about the answers!

Ask a question

Creating Workitem using OSLC 2.0

Sudipto Sarkar (63334) | asked Apr 17 '15, 2:47 a.m.

 I need to create a workitem using oslc 2.0. I am not getting the exact format of the request body to out in the rest client. Can anyone show me an exact example of the xml that I can use?


Accepted answer

permanent link
Dinesh Kumar B (4.0k413) | answered Apr 17 '15, 3:08 a.m.

From my setup where creation factory is accessible through :
<oslc:creation rdf:resource=""/>
I perform a POST on
with content type header set to :
Content-Type : application/xml
and body :
    <?xml version="1.0" encoding="UTF-8"?>
        xmlns:oslc_cm="" >

        <dc:title>Contribute To on a REST WI</dc:title>
        <dc:type rdf:resource=""/>
        <dc:description>To check the Contributes To on a REST created Work Item</dc:description>
        <dc:creator rdf:resource=""/>
the Task work item gets created.

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
Sudipto Sarkar selected this answer as the correct answer

Sudipto Sarkar commented Apr 17 '15, 3:34 a.m.

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!

Dinesh Kumar B commented Apr 17 '15, 4:01 a.m. | edited Apr 17 '15, 4:02 a.m.

glad to know that.. please accept the answer if it covered your question.

its for OSLC 2.0.. 

Sudipto Sarkar commented Apr 17 '15, 8:22 a.m.

Hi Dinesh,

 One more question, what is the tag for filed against in OSLC?

Sudipto Sarkar commented Apr 28 '15, 1:42 a.m.

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?


Dinesh Kumar B commented Apr 28 '15, 2:21 a.m.

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
which has the listing of all the attributes and
for filed against it is :

Sudipto Sarkar commented Apr 28 '15, 4:00 a.m.

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".


Leon Sun commented Jan 24 '18, 4:04 p.m. | edited Jan 24 '18, 4:05 p.m.

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.

showing 5 of 7 show 2 more comments

Your answer

Register or to post your answer.