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

How do you specify work item type when creating a draft using REST API?

 I am trying to specify that a "task" workitem type be created when I create a draft using the CURL command below, but the resulting draft is type "defect". The RTC project is Jazz Foundation in the example below, but I have found that the dc:type that I specify is ignored on more than just this project.

curl.exe -k -H "Content-Type: application/x-oslc-cm-change-request+json" -H "Accept: application/json" -X POST -d @newtask.json https://jazz.net/jazz/oslc/contexts/_Q2fMII8EEd2Q-OW8dr3S5w/drafts/workitems

This is the content of newtask.json:
{
    "dc:title": "This is Lori's task draft",        
    "dc:type":{"rdf:resource":"https:\/\/jazz.net\/jazz\/oslc\/types\/_Q2fMII8EEd2Q-OW8dr3S5w\/task"},      
    "rtc_cm:teamArea":{"rdf:resource": "https:\/\/jazz.net\/jazz\/oslc\/teamareas\/_I3iq8BTPEd6zz6xdSaYlGQ"},
    "rtc_cm:filedAgainst":{"rdf:resource": "https:\/\/jazz.net\/jazz\/resource\/itemOid\/com.ibm.team.workitem.Category\/_v2l5gBTPEd6zz6xdSaYlGQ"},       
}

The resulting draft is here, but it is type Defect rather than Task: https://jazz.net/jazz/web/projects/Jazz%20Foundation?draftId=_-LMWQHtdEeaRDptxjI8dMA#action=com.ibm.team.workitem.newWorkItem&ts=1473955450942&draftId=_-LMWQHtdEeaRDptxjI8dMA

0 votes


Accepted answer

Permanent link

You get the creation factory for the type and use that.
Ralph Schoon selected this answer as the correct answer

0 votes


One other answer

Permanent link

Did you found a solution? On RTC 6.0.6 I have same problem.

0 votes

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,926
× 478

Question asked: Sep 15 '16, 1:35 p.m.

Question was seen: 3,197 times

Last updated: Jun 05 '20, 8:58 a.m.

Confirmation Cancel Confirm