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

OSLC REST API: How to set a "drop down list" attribute programmatically, for ex: "Severity", for a RTC WI.

Below is the code used to construct Work item programmatically. 

     String sStartOSLC = "<oslc_cm:ChangeRequest";
  String sEndOSLC = "</oslc_cm:ChangeRequest>";
        String xmlNS =  " xmlns:dc=\"http://purl.org/dc/terms/\"   xmlns:rtc_cm=\"https://jazz.net/xmlns/prod/jazz/rtc/cm/1.0/\"  xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"  xmlns:oslc_cm=\"http://open-services.net/xmlns/cm/1.0/\" xmlns:oslc_cmx=\"http://open-services.net/ns/cm-x#\">";
        String sType = "<rtc_cm:type rdf:resource=\""+sType_data+"\"/>";       
        String sTitle = "<dc:title>"+"A New Defect for OSLC_5"+"</dc:title>";
        String sSeverity = "<oslc_cmx:severity>"+"severity.literal.l3"+"</oslc_cmx:severity>";       
        String sPriority = "<oslc_cmx:priority>"+"priority.literal.l3"+"</oslc_cmx:priority>";
        String sProjectArea = "<dc:projectarea>"+"Test RTC (Project)"+"</dc:projectarea>";
        String steamArea = "<dc:teamarea>"+"Test RTC (Project)"+"</dc:teamarea>";
        String sDescrption = "<dc:description>"+"OSLC Rest Service Test Defect Creation_5"+"</dc:description>";       
              
          String sOslcXML = sStartOSLC+xmlNS+sTitle+sType+sSeverity+sPriority+sProjectArea+steamArea+sDescrption+sEndOSLC;
        HttpEntity myEntity = new StringEntity(sOslcXML);
  httppost.setEntity(myEntity);

Using the above code I am able to create a workitem programmatically. The problem is only Text area fields like Title, Description are populated but it could not populate Drop down values like Severity,

0 votes



One answer

Permanent link
You need to understand what these dropdown fields really are in order to update them correctly using OSLC. "Severity" is an enumeration, and FiledAgainst is a category, for both the value has to be the full resource URL. You'd better do a GET first and examine the response body carefully before doing a PUT or POST. Go through the tutorial first and always refer back to the wiki.
https://jazz.net/library/article/1001
https://jazz.net/wiki/bin/view/Main/WorkItemAPIsForOSLCCM20

0 votes

Comments

Thank you Donald.

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,950
× 1,700

Question asked: Sep 16 '15, 8:48 a.m.

Question was seen: 3,392 times

Last updated: Sep 28 '15, 6:12 a.m.

Confirmation Cancel Confirm