It's all about the answers!

Ask a question

How do you submit category fields in a new work item post?

Shawn Carroll (3613) | asked Apr 05 '17, 3:09 p.m.

I need to create a post command to use to create new work items and this is my first time having to submit data for a category field. I don't know how to properly format the xml and I would love to see an example of it or some type of how-to guide that I haven't been able to find yet.


5 answers

permanent link
Donald Nong (14.5k414) | answered Apr 05 '17, 10:09 p.m.

The easiest way to get an example is to GET an existing work item and examine its XML content. You can start with these articles.

Shawn Carroll commented Apr 06 '17, 10:52 a.m.

I've done that, but the filed against entry only lists a web address that contains nested xml content. I copied that nested xml content into my POST and inserting the submitted information into the fields, but that didn't work. I don't know how the POST is supposed to be formatted to transfer the filedAgainst fields to RTC.

permanent link
Jean-Luc Johnson (8125) | answered Apr 06 '17, 12:07 p.m.
edited Apr 06 '17, 12:09 p.m.


From your question, I could not tell whether you are creating a new work item with a REST client or programmatically.
It shows how to specify the property category.

Please start from there, somewhere from line 230 to 246. I will look into it this afternoon and I try to provide more details by tomorrow morning.

Best regards,

permanent link
Jean-Luc Johnson (8125) | answered Apr 06 '17, 12:21 p.m.

Hello again,

It looks simple to understand. 

The sample code says: look into the service provider RDF document.
Identify the creation factory node.
It specifies the expected work item resource shape.
The resource shape document comes with one or  many properties "file against": URI = RTC_NAMESPACE + RTC_FILED_AGAINST.
We would need to select one of the allowed values. Let's called it "values[1]" . Then please extend your Work item RDF document (or java object) with a new statement:

Constant values: 
RTC_FILED_AGAINST = "filedAgainst";

I hope it helps.
Best regards,
Jean-Luc Johnson, Airbus

Note: if you like my answer please like it (thumb up). I will appreciate.

Shawn Carroll commented Apr 06 '17, 2:01 p.m.

I'm using a REST client via PERL scripts to submit this POST. I'm not familiar with the documents that you mentioned though.

permanent link
Jean-Luc Johnson (8125) | answered Apr 06 '17, 2:05 p.m.


Please follow the instructions in my second post. The code is well commented. You should be able to reproduce the same instructions into Perl.

Let me know how far you have been.

permanent link
Donald Nong (14.5k414) | answered Apr 06 '17, 11:01 p.m.

Shawn, I'm not quite sure why you could not do it, as it is quite simple. Whether you use Perl or not should not matter. For example, if I POST to the below URL

with the below RDF content

  <oslc_cm:ChangeRequest rdf:about="">
    <dcterms:title rdf:parseType="Literal">Test OLSC POST</dcterms:title>
    <rtc_cm:filedAgainst rdf:resource=""/>

I can create a new Defect work item without any problems. The required headers for this request are

"OSLC-Core-Version: 2.0", "X-Jazz-CSRF-Prevent: <actual JSESSIONID value>" and "Content-Type: application/rdf+xml"

Shawn Carroll commented Apr 07 '17, 10:08 a.m.

I don't know how you created that rdf:resource address value, or how you filled in the fields contained within it.

Donald Nong commented Apr 09 '17, 9:10 p.m.

In a previous comment, you said that "I've done that, but the filed against entry only lists a web address that contains nested xml content", what is exactly what it is, the category. If you want to get all the available category values, check out the below post.

Shawn Carroll commented Apr 10 '17, 10:06 a.m.

My issue is that I don't want to get the values. I'm trying to create a new work item and I need to set a field within that address. I don't know what the format of the xml needs to look like to set a field within that web address.

Donald Nong commented Apr 13 '17, 6:17 a.m.

I don't really understand what you try to do. The Filed Against attribute is mandatory and you have to set a value to it when creating a work item. You keep using the term "address" which only confuses yourself. "Resource URI" is a more proper term. You should consider the category value as an identifier, rather than an HTTP URL.

Shawn Carroll commented Apr 13 '17, 11:08 a.m.

I've never manually set the Filed Against attribute when creating work items. I don't know how to modify the resource URI and set the Filed Against attribute in xml when creating a new work item.

Donald Nong commented Apr 13 '17, 10:44 p.m.

So you haven't really read my answer and the subsequent comments then. If you have difficulties in understanding the resource URI, I suggest you practice updating an existing work item by modifying its Enumeration attributes (Priority, Severity and etc).

Shawn Carroll commented Apr 17 '17, 4:27 p.m. | edited Apr 17 '17, 4:33 p.m.

I've read them, they just weren't helpful to me in understanding how to solve my issue.

showing 5 of 7 show 2 more comments

Your answer

Register or to post your answer.