REST API to create Work Item in RTC
Hi team,
I am using Postman as a Rest Client and I want to create Work Item in RTC using Rest API. Please help for the same
|
2 answers
Ralph Schoon (63.1k●3●36●46)
| answered Jun 16 '21, 9:35 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
I hinted in https://jazz.net/forum/questions/275433/to-find-all-project-areas-in-rtc-using-rest-apipostman to follow https://jazz.net/wiki/bin/view/Deployment/CLMProductAPILanding and do the https://jazz.net/library/article/635 Not sure if that was done.
You would discover the work item service: See https://jazz.net/wiki/bin/view/Main/WorkItemAPIsForOSLCCM20#Discovery_Mechanism and also see https://jazz.net/wiki/bin/view/Main/ResourceOrientedWorkItemAPIv2#Discovery
From there you get what you need. The sequence looks like this:
Rootservices:
Request GET https://elm.example.com:9443/ccm/rootservices
Catalog (Project Areas)
Request GET https://elm.example.com:9443/ccm/oslc/workitems/catalog
Project Area service descriptor for one project area
Request GET https://elm.example.com:9443/ccm/oslc/contexts/_8e5qfFpmEeukW7cqqDjAuA/workitems/services
Get creation Factory for the type
Resource Shape for the work item type of one project area
Request GET https://elm.example.com:9443/ccm/oslc/context/_8e5qfFpmEeukW7cqqDjAuA/shapes/workitems/
Resource Shape defines available attributes and the allowed values for attributes
Get details for complex values (Category, Target, Enumerations) following the links
Example Category “unassigned” see "dcterms:title": "Unassigned" Request GET https: //elm.example.com:9443/ccm/resource/itemOid/com.ibm.team.workitem.Category/_8s97oVpmEeukW7cqqDjAuA
Compose the Request body with the attributes needed for the work item and post
Request POST https://elm.example.com:9443/ccm/oslc/contexts/_8e5qfFpmEeukW7cqqDjAuA/workitems/defect
Body: {"dcterms:title": "Work Item Created from JSON in Python.", "dcterms:description": "This is a work item linking to <a href=\"https://jazz.net/\">Jazz.net</a>.", "rtc_cm:filedAgainst": {"rdf:resource": "https://elm.example.com:9443/ccm/resource/itemOid/com.ibm.team.workitem.Category/_HWNLMFpnEeukW7cqqDjAuA", "rdf:type": [{"rdf:resource": "http://jazz.net/xmlns/prod/jazz/rtc/cm/1.0/Category"}]}} |
Hello,
I believe the links here answers your question:
|
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.