Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

Creating Workitem using OSLC 2.0

Hi,

 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?

Thanks,
Sud

0 votes


Accepted answer

Permanent link

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/task
with content type header set to :
Content-Type : application/xml
and body :
    <?xml version="1.0" encoding="UTF-8"?>
        <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>
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

1 vote

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.

showing 5 of 7 show 2 more comments

Your answer

Register or log in 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.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 10,922

Question asked: Apr 17 '15, 2:47 a.m.

Question was seen: 5,035 times

Last updated: Jan 24 '18, 4:05 p.m.

Confirmation Cancel Confirm