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

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!

1

0 votes



5 answers

Permanent link

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

0 votes

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.


Permanent link

 Hello,

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,
Jean-Luc

0 votes


Permanent link

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:
(RTC_NAMESPACE + RTC_FILED_AGAINST,  values[1])

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.

0 votes

Comments

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

 Fine,

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.

0 votes


Permanent link

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

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

0 votes

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.

showing 5 of 7 show 2 more comments

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
× 12,019
× 516

Question asked: Apr 05 '17, 3:09 p.m.

Question was seen: 3,521 times

Last updated: Apr 17 '17, 4:33 p.m.

Confirmation Cancel Confirm