It's all about the answers!

Ask a question

Unable to fetch the custom attribute prefix tag of artifect type defect

Rahul Singh Bhadauriya (2821720) | asked Mar 10 '14, 6:44 a.m.
edited Mar 10 '14, 9:19 a.m. by Paul Slauenwhite (8.4k12)
RTC Version 4.0.3

I have created custom attribute in the RTC of WorkItem type Defect.
I have marked these attributes as a mandatory . I want to create defects in RTC using my java client.

1. How to fetch the attribute prefix Tag to create the XML change request .
<rtc_ext:Test1 rdf:datatype="">10</rtc_ext:Test1>
here, Test1 is a mandatory attribute of type integer added in Workitem type Defect.
rtc_ext:Test1 Tag is required to create XML Change Request to create defects in RTC which i am unable to fetch.

2. what about system defined attributes , how to fetch the prefix tags for those?

rtc_cm:filedAgainst rdf:resource="https://localhost:9443/ccm/resource/itemOid/"/>

here, I need to fetch the Tag
I am able to fetch the internal name of the attribute from the resource shape. 


One answer

permanent link
Donald Nong (14.5k614) | answered Mar 10 '14, 11:13 p.m.
It sounds strange that you cannot find the information in the resource shape. I suppose you get confused with what the "prefix" is - it is simply a namespace declaration, or a "shorthand" if you like. Here is something you can do, and hopefully get what you want.
1. Follow the usual chain of discovery till you get the resource shape of the defect. In the shape content, search the custom attribute name and you should get something like this
<oslc:propertyDefinition rdf:resource=""/>
Here the name space is and you need to declare this before you can use it in a request body.
2. Depending on the name of your choice, you can declare the namespace as below
In this case, you can use <rtc_ext:customAttribute> to refer to your custom attribute in your request body.
3. If you want to get a sample of the RDF/XML presentation of a Defect work item, simply do a GET request of an existing Defect work item with the custom attribute. At the top part of the response, you should observe the same line as quoted above. All the attributes with the "rtc_ext" prefix are custom attributes. The other attributes have different prefix depending on in which namespace they are defined.
I don't know how you do the "fetch", but to get consistent result, always use HTTP headers "Accept: application/rdf+xml" and "OSLC-Core-Version: 2.0" with your request.

Rahul Singh Bhadauriya commented Mar 11 '14, 10:19 a.m.

Thanks Donald for your quick response. Now i am able to identify the attribute prefix based on the name spaces defined for them.

Your answer

Register or 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.