It's all about the answers!

Ask a question

How to discover user defined attributes using REST API


Bill Waldie (1111) | asked May 10 '12, 2:58 a.m.
I am trying to create a new workitem following the examples shown in:

https://jazz.net/wiki/bin/view/Main/ResourceOrientedWorkItemAPIv2

In our system there is a new attribute that is required to create the new workitem.

when I look an existing workitem using:

curl -k -b $COOKIES "$HOST/oslc/workitems/2959.xml"


I see it looks like this:
<rtc_cm>


How do I use this information - or better yet - I do I discover the valid settings - to use in my version of create-simple.json?

{

"dc:title":"My first new work item",
"dc:description":"A description for the new work item",
"dc:type":"defect",
"rtc_cm:discovered_by":"Customer"
}


When I use a known good value for the discovered_by, it returns the error:

{

"oslc_cm:message": "Illegal value: Customer",
"oslc_cm:status": 409
}

2 answers



permanent link
Bill Waldie (1111) | answered May 10 '12, 3:01 a.m.
I am trying to create a new workitem following the examples shown in:
https://jazz.net/wiki/bin/view/Main/ResourceOrientedWorkItemAPIv2
In our system there is a new attribute that is required to create the new workitem. When I look an existing workitem using:
curl -k -b $COOKIES "$HOST/oslc/workitems/2959.xml"

I see it looks like this:
<rtc_cm:discovered_by rdf:resource="https://localhost:9443/ccm/oslc/enumerations/_iDjGoDuwEeCpC8m1BEftMg/discovered_by/discovered_by.literal.l8"/>


How do I use this information - or better yet - I do I discover the valid settings - to use in my version of create-simple.json?
{

"dc:title":"My first new work item",
"dc:description":"A description for the new work item",
"dc:type":"defect",
"rtc_cm:discovered_by":"Customer"
}

When I use a known good value for the discovered_by, it returns the error:
{

"oslc_cm:message": "Illegal value: Customer",
"oslc_cm:status": 409
}

permanent link
Bill Waldie (1111) | answered May 12 '12, 8:31 p.m.
I found my problems:

1. I was not using the correct context. My sample value came from a different project area, but I did not change it when trying to use the value returned by xml query.

<rtc_cm:discovered_by rdf:resource="https://localhost:9443/ccm/oslc/enumerations/_iDjGoDuwEeCpC8m1BEftMg/discovered_by/discovered_by.literal.l8"/>

2. When I did correct the project area, I did not notice the last part of the above is not one-eight, but ell-eight.

So, the suggestion to 'figure out a custom attribute: read back a workitem and see what the value is set to' does work. Still not discoverable, but in my case this can be hard coded to one of the four options fairly easily.

Your answer


Register or to post your answer.