Practicalities of the RTC 2.0 Rest APIs
![]()
Hi,
I am trying to accomplish the relatively simple use case of programatically creating a new defect work item in my RTC 2.0 project. I'm doing this in Java, but that isn't relevant for this question. So far: - I have retrieved the service document - From that I have retrieved the change management catalog - From that I have found my project area and retrieved its service document So, I have the URL to which I can POST new work items. However, looking at the example at: https://jazz.net/wiki/bin/view/Main/ResourceOrientedWorkItemAPIv2#Creating_Work_Items and I am wondering how exactly I can obtain the resource URLs for a number of items in my work item such as the filed against category and an owner. For instance, in the example, the filed against is set to: https://publicuri.test.org:9443/jazz/resource/itemOid/com.ibm.team.workitem.Category/_-hBTUEqVEd6HXO10niqZpg How can I discover the URIs for the categories my project defines? When retrieving a work item, I note that authors/owners/subscribers are represented like this: https://myserver/jazz/oslc/users/_bXh-MI2KEd67ZIuoGFYkQg Which when requested returns a parseable document with user information, but again how can I do the reverse and take information such as a userid and obtain the URI for that user? I've looked through the change management and project area service documents but can't see anything obvious to try and retrieve. Also, I've not found documentation for querying anything other than work items. Any clues? |
16 answers
![]()
Hi Tristan,
The 'must-revalidate' is part of the Cache-Control header, so I don't think it's an indication of the problem. It's basically telling any caches to be sure not to serve cached content unless the client has properly authenticated. Also, it doesn't seem to be an authentication problem, or I'd expect to get a 401 instead of a 400. Is there any body to the response with more details? |
![]()
The guidance and tools mentioned in the OSLC Workshop may be helpful too: https://jazz.net/library/article/635
|
![]() The guidance and tools mentioned in the OSLC Workshop may be helpful too: https://jazz.net/library/article/635 Hi Nick, Thanks for the help! I'm new at web programming and forgot to check the HttpResponse entity (message). I changed my JSONOBject as follows:
And the message reads :
This seems pretty straight-forward. I figure all I need to do is define what type of Work Item my draft Work Item will be (e.g. Task, Story etc). However, I do have a further question. From the examples it seems that the Work Item Types are defined in our project area. Do you know where I could find the rdf:resource link for a Task? In other words, would I find the Task definition to add to my JSON object in the services.xml file I retrieved? Thanks again, Tristan |
![]()
I played around with it a bit using the REST Client plugin.
A post to: https://jazz.net/jazz/oslc/contexts/_1w8aQEmJEduIY7C8B09Hyw/drafts/workitems with the headers and body you gave resulted in a body of:
If I add the type, so body is: {"dc:title":"UserFeedback","dc:type":"defect"} then I get back a result where the body is the JSON for the draft work item, and the Location header has its URL. You would then bring the user to that URL, which will redirect to the web UI, and let them complete the draft item and save it. |
![]()
The types are at, e.g.:
https://jazz.net/jazz/oslc/types/_1w8aQEmJEduIY7C8B09Hyw where the UUID is the context id (aka project area item id). Not sure if this is part of the OSLC_CM spec. I don't think it is. The dc:type field when creating the work item should be one of the dc:identifiers for the listed types, e.g. "defect" or "task". It may also accept the type's URI, e.g. https://jazz.net/jazz/oslc/types/_1w8aQEmJEduIY7C8B09Hyw/task |
![]()
Hi Nick,
It works! Thank you very much for the help! Tristan I played around with it a bit using the REST Client plugin. |
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.