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

Creating Workitem using REST

When creating a work item (for example the standard Defect) using REST, some fields has to be set using rdf:resource.

The way I have done it right now is to fetch an existing defect, looking at the rdf:resource of a value and then guessed that the URI to the collection is the URI, but removing the item at the end. This way I found out that, for example,
Severity = /ccm/oslc/enumerations/project-area id/severity
Type = /ccm/oslc/types/project-area id
This way I can use those URIs to fetch RDF representations that I can use to present the user with the possibility to select Type and Severity.

The problem comes with the field FiledAgainst. Fetching a defect gives me, for example, the rdf:resource /ccm/resource/itemOid/com.ibm.team.workitem.Category/_m9O4y1vOEeG5D_zZmW3LWA.
Fetching this resource returns the active Category, but I cannot find a way to get the complete Category list. If I try to get /ccm/resource/itemOid/com.ibm.team.workitem.Category I get an error saying "Malformed current state URI selector: 'com.ibm.team.workitem.Category'"

My question is, how can (should) I program-wise fetch the possible values for the fields that are not free-text? Can the links I found out (for Type and Severity) be trusted or might this be part of changes in the future? And if yes, how is the proper way to get the list?

0 votes



6 answers

Permanent link
I had a similar thread in https://jazz.net/forums/viewtopic.php?p=66741

This answer some of what you have already figured out. This will be much better in 4.0 with support for resource shapes associated with the creation factory.

Offhand I don't know how to get the list of categories, will have to find some time to research it. I'd approach it by poking around at their OSLC support and then see how the work item web editor is making the calls to the server.

Sorry I can't be of more help.

- Steve

0 votes


Permanent link
Thank you Steve.
I will continue to use this URI for types then and look a bit through the code and see if I can understand how FiledAgainst is created.

0 votes


Permanent link
Details of the new support are tracked in Story 141541

0 votes


Permanent link
Details of the new support are tracked in Story 141541


Firstly, as Steve said, OSLC shapes associated to the work item creation factory & work item shapes can be used for finding out the values for a property of a work item programmatically. This is supported from 4.0.

For pre 4.0 usage, unfortunately there is no discovery mechanism for finding out the URLs for non-oslc based resources like Category. But I can help you in providing the collection URL for them. For Category it is /ccm/oslc/categories. This will give out all categories URLs.

I would say the correct approach to find a value of a property for a resource programmatically is by accessing its shape.


Thanks
Sandeep

0 votes


Permanent link
Thank you Sandeep.

I saw that it also works with oslc.where to be able to select only categories for a specific project area (in our production environment we have about 3000 categories right now so it's a bit heavy to find the correct ones if selecting all ;) )

0 votes


Permanent link
Thank you Sandeep.

I saw that it also works with oslc.where to be able to select only categories for a specific project area (in our production environment we have about 3000 categories right now so it's a bit heavy to find the correct ones if selecting all ;) )


Mattias,
Can you give me the syntax for filtering categories by project area? The full URL will be great. I am getting a oslc:Error - Illegal argument 'Project Area': _d-9T0I7fEeG7bO3Ur0YViA

My URL is: https://appserver.ibm.com:19443/ccm/oslc/categories?oslc.select=rtc_cm:Category,rtc_cm:projectArea&oslc.where=rtc_cm%3AprojectArea%3D%22_d-9T0I7fEeG7bO3Ur0YViA%22

It turns out that this URL works fine in v3.0.1.3 but returns the illegal argument error in v4.0 RC4a

Thanks,
Prem.

0 votes

Comments

Any luck figuring out a strategy for selecting by project area? 

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

Question asked: Feb 20 '12, 10:21 a.m.

Question was seen: 6,544 times

Last updated: Nov 08 '12, 9:52 a.m.

Confirmation Cancel Confirm