How do you submit category fields in a new work item post?
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.
Thanks!
5 answers
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.
https://jazz.net/library/article/635
https://jazz.net/library/article/1001
https://jazz.net/wiki/bin/view/Main/WorkItemAPIsForOSLCCM20
Comments
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.
Hello,
Hello again,
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
https://clm603.example.com:9443/ccm/oslc/contexts/_FVy1YAjwEeeM_4AJeU0Ckw/workitems/defect
with the below RDF content
<rdf:RDF
xmlns:process="http://jazz.net/ns/process#"
xmlns:acp="http://jazz.net/ns/acp#"
xmlns:rtc_cm="http://jazz.net/xmlns/prod/jazz/rtc/cm/1.0/"
xmlns:oslc_cmx="http://open-services.net/ns/cm-x#"
xmlns:oslc_pl="http://open-services.net/ns/pl#"
xmlns:oslc_cm="http://open-services.net/ns/cm#"
xmlns:oslc="http://open-services.net/ns/core#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:acc="http://open-services.net/ns/core/acc#"
xmlns:rtc_ext="http://jazz.net/xmlns/prod/jazz/rtc/ext/1.0/"
xmlns:dcterms="http://purl.org/dc/terms/">
<oslc_cm:ChangeRequest rdf:about="">
<dcterms:title rdf:parseType="Literal">Test OLSC POST</dcterms:title>
<rtc_cm:filedAgainst rdf:resource="https://clm603.example.com:9443/ccm/resource/itemOid/com.ibm.team.workitem.Category/_opNfsQjwEeeM_4AJeU0Ckw"/>
</oslc_cm:ChangeRequest>
</rdf:RDF>
I can create a new Defect work item without any problems. The required headers for this request are
Comments
I don't know how you created that rdf:resource address value, or how you filled in the fields contained within it.
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.
https://jazz.net/forum/questions/162770/how-to-programmatically-get-list-of-all-filed-against-values
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.
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.
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.
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).
I've read them, they just weren't helpful to me in understanding how to solve my issue.