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

RTC 6.0.6.1 Failing to set Priority & Severity...other enums OK

I am writing a tool that creates new work items with quite a few attributes. The POST is working fine and the work item is being created with no errors and all attributes are being set, except for priority and severity.


Priority and Severity are ignored... I have tried the following:

"oslc_cm:priority":{"rdf:resource":"<<resource url for literal>>"}
and 
"oslc_cmx:priority":{"rdf:resource":"<<resource url for literal>>"}

My headers are:
Content-Type: application/json
OSLC-Core-Version: 2.0

If I do a GET, the JSON does have additional items in the JSON... like this:
"oslc_cmx:priority":{"rdf:resource":"<<resource url for literal>>", "rdf:type":[{"rdf:resource":"https://rtc.domain/ccm/oslc/enumerations/_projectId/priority"},{"rdf:resource":"http://jazz.net/xmlns/prod/jazz/rtc/cm/1.0/Literal"}]}

I even tried including those parts that seem unnecessary, but the severity and priority are ignored.

Can someone send me a working example json that includes priority and severity and successfully creates a new work item and sets priority and severity?

Thanks,

Dave

0 votes


Accepted answer

Permanent link

 Dave,


this is the JSON body I sent and it created the work item just fine.

{
    "dcterms:title": "Work Item Created from JSON in Python.",
    "dcterms:description": "This is a work item linking to Jazz.net">https://jazz.net/\"">Jazz.net.",
    "rtc_cm:filedAgainst": "https://elm.example.com:9443/ccm/resource/itemOid/com.ibm.team.workitem.Category/_HWNLMFpnEeukW7cqqDjAuA",
    "oslc_cmx:priority": "https://elm.example.com:9443/ccm/oslc/enumerations/_8e5qfFpmEeukW7cqqDjAuA/priority/priority.literal.l11"
}
    
I used the creation factory and the allowed values for the attribute with Title "Priority" and value "High" to get the enumeration literal.

Dave Evans selected this answer as the correct answer

0 votes

Comments

PS: at the moment I have no idea how to get the  "oslc_cmx:priority" from the  property definition: "oslc:propertyDefinition": {

                "rdf:resource": "http:\/\/open-services.net\/ns\/cm-x#priority"  }

In RDF XML, this is very easy, not sure how to do that in JSON.

If an RDF framework such as Python RDFLib is available, it is possible to create a mapping for the namespace prefix and the namespace.

    oslc_cmx = 'oslc_cmx'
    oslc_cmx_URI = 'http://open-services.net/ns/cm-x#'
    oslc_cmx_ns = Namespace(oslc_cmx_URI)

g = Graph()
    g.bind("rdf", RDF)
    g.bind("rdfs", RDFS)
    g.bind("dcterms", DCTERMS)
    g.bind(self.oslc_cmx, self.oslc_cmx_ns)

        .......

    definition = URIRef('http://open-services.net/ns/cm-x#priority')
    result = definition.n3(g.namespace_manager)


This allows to resolve the information 'oslc_cmx:priority'.

If there is no such framework it would be necessary to create a custom mapping  e.g. from 'http://open-services.net/ns/cm-x#' to 'oslc_cmx'

Oh, interesting. For some reason I thought the rdf:resource property was required in the json. I left it out following your example and it WORKS! THANKS RALPH!


Interesting since the response json adds the "rdf:resource" part that isn't needed.

I tried to share some of my experience in this blog series: https://rsjazz.wordpress.com/2021/09/29/using-the-ewm-rest-and-oslc-apis/ 

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
× 10,937
× 516
× 11

Question asked: Apr 18 '22, 2:13 p.m.

Question was seen: 954 times

Last updated: Apr 20 '22, 1:52 a.m.

Confirmation Cancel Confirm