It's all about the answers!

Ask a question

Creating Draft Work Item returns 500

Bryan Perino (546) | asked Feb 18 '14, 5:24 p.m.
edited Feb 18 '14, 5:41 p.m.

I am trying to create a draft work item using JSON. I am passing the following information to the url

"title":"A test defect",  
     }   }

However, I am getting the following error message back

	{"prefixes":{"oslc":"http:\/\/\/ns\/core#"},"oslc:message":"null argument:","oslc:statusCode":500}

Does anybody have any idea why it is returning that error? The url was taken from an existing Work Item. 

Donald Nong commented Feb 18 '14, 8:54 p.m.

500 internal error can mean anything. You need to check the log file to find out the relevant errors. Also, you did not say what URL you passed the JSON to, and it is difficult for others to imagine what might go wrong.

Bryan Perino commented Feb 18 '14, 9:35 p.m.

Sorry about the lack of information. Here is the url that I am sending the request to

I haven't had access to the logs yet. How would I discover what the url is for the types and what name I need to use. Instead of "rtc_cm:type", could it be something different?

I got that URL by following the

Root Doc -> Service Catalog -> Service Provider

7 answers

permanent link
Dave Evans (14812846) | answered Apr 24 '20, 4:07 p.m.
edited Apr 24 '20, 4:15 p.m.

 This is so stupid. But I got it working.

The JSON needs to be just like in the original question, BUT the 'Location' property needs to be taken and modified.

For example, my response header has:
Location: https://<server>/ccm/resource/itemOid/

But if you go there, it opens the editor with the default work item type (virtually useless if it can't even get the type right).

However, if you take information like the draftID from the location, and build a URL like this, it works:

Note: I am using 6.0.6. And I am using an AJAX request WITHOUT the OSLC version header. Here is my full AJAX request for the work item post:
var simpleWI = new Object();
simpleWI['dc:type'] = new Object();
simpleWI['dc:type'][rdf:resource'] = (Work Item Type URL);
simpleWI['dc:title'] = "Any title you desire";

var str = JSON.stringify(simpleWI);
var URL = RTCURL() + "oslc/contexts/" + ProjectItemId + "/drafts/workitems";

    async:true, xhrFields: {withCredentials: true}, url: URL,
    type: 'POST',
    data: str,
    'Content-Type' : 'application/json',
    success: function(response, status, xhr){
        let location = xhr.getResponseHeader("location");
        let draftId = location.substr(location.indexOf('draftId='));
        let url = projectURL + "?" + draftId + "" + draftId + "&type=" + WITypeId;, "_blank");
    error: function(error){

permanent link
Alex Fitzpatrick (5583816) | answered May 20 '14, 4:18 p.m.
I think all you need is a valid type, I found that on my server I could create defects with nothing more than that.



I determined the type by fetching the workitems from my projects area and looking for the type I needed:


Bryan Perino commented May 28 '14, 2:05 p.m.

Here are the results. I tried it once with dc:type and the other with rtc_cm:type

Neither one seemed to work. 

Donald Nong commented May 28 '14, 10:47 p.m. | edited May 28 '14, 10:51 p.m.

Just to keep the discussion going. I get the same 500 error "null parameter" when I post the below JSON

    { "dcterms:title": "Offer more services related to loans", "rtc_cm:type": { "rdf:type": [ { "rdf:resource": "" } ], "rdf:resource": "https://<server>:<port>/ccm/oslc/types/_YAOpUK2SEeOZZsxCNqN2HA/defect" } }
If I post the same content with the same setting to create a WI (not a draft), I get the error "'Save Work Item' failed. Preconditions have not been met: The 'Filed Against' attribute needs to be set (work item <12:44:28>)." as expected.

Alex Fitzpatrick commented May 29 '14, 4:42 p.m.
With out of the box projects, this also works.



joe meagher commented Dec 13 '17, 8:58 p.m.

Has something changed?  It seems the 'type' attribute is ignored in the newer releases (I'm testing on 6.0.4) when creating a draft workitem.  I've tried various forms, all are ignored.


Any ideas?

Dave Evans commented Apr 24 '20, 3:42 p.m.

I'm seeing the same thing. Type seems to be ignored, but the other parts of my JSON are respected. IBM Support told me they don't support OSLC so to come and ask the developers here!

Dave Evans commented Apr 24 '20, 3:44 p.m.

 There has been a defect since v3:

I'll try manipulating the URL to specify the type.

Geoffrey Clemm commented Apr 24 '20, 8:02 p.m.

If you can provide support with a small program that demonstrates the problem when run against the out-of-the-box Money That Matters project area, they should be willing to reproduce the problem and give you some guidance (or create a defect for the problem).  Or in this case, let you know it is a known defect. 

showing 5 of 7 show 2 more comments

permanent link
Eric Jodet (6.3k5111120) | answered Feb 26 '14, 9:10 a.m.
please open a new defect against Work Item comp,
add your code, steps, and part of the ccm log that shows the AssertionFailedException,

Please add a link to the work item in this thread.


Bryan Perino commented Feb 26 '14, 10:09 a.m.

What would be the best way to open a defect? My company purchased RTC, so should I do it through them?

Eric Jodet commented Feb 26 '14, 10:11 a.m.

 yes - you may open a formal ticket - aka PMR -


permanent link
Donald Nong (14.5k614) | answered Feb 25 '14, 7:27 p.m.
I believe this is a defect based on my testing. Here are the couple of points I would bring up.
1. The instanceShape of the work item type in question (Task in my case) states that only the title/summary is required, since only for this attribute the <oslc:occurs/> value is "Exactly-one" and all the others are "Zero-or-one" or "Zero-or-many".
2. Using the same POST content (I used the presentation of an existing work item less the identifier), I could submit a work item, but not a "draft" work item. Creating draft work items always fails with the same error as quoted in Eric's post above. It's a bit ironic since it should have been much easier to create a "draft" than a proper one.
BTW, I'm using CLM 4.0.5.

Alex Fitzpatrick commented May 20 '14, 4:15 p.m.
I can create empty drafts with nothing more than a valid dc:type. 

What did you do to get this to fail?

permanent link
Eric Jodet (6.3k5111120) | answered Feb 25 '14, 12:38 p.m.
I was about to give you this reference, but was stuck with something else.
This doc states:
 Creating a draft works exactly the same as creating a regular work item, but is not susceptible to missing required attributes.

So I would not expect any error regarding missing attributes.

I need to test, possibly tomorrow if able

permanent link
Eric Jodet (6.3k5111120) | answered Feb 21 '14, 2:11 a.m.
 Hello Brian,
log shows:
  1. org.eclipse.core.runtime.AssertionFailedException: null argument:
  2.         at org.eclipse.core.runtime.Assert.isNotNull(
  3.         at org.eclipse.core.runtime.Assert.isNotNull(
  4.         at
  5. 29)

which makes me believe we're missing rtc_cm:state here.
    "rtc_cm:state": {
        "rdf:resource": "https:\/\/rtc:9443\/ccm\/oslc\/workflows\/_FckdEKD8EeGCjPo2EBGANQ\/states\/\/3",
        "rdf:type": [
                "rdf:resource": "http:\/\/\/xmlns\/prod\/jazz\/rtc\/cm\/1.0\/Status"

Bryan Perino commented Feb 25 '14, 11:19 a.m.

 What is required to create a draft work item? I keep trying to find the documentation, but I have hard time keeping track of where it is. 

Bryan Perino commented Feb 25 '14, 11:24 a.m.

 I actually found the documentation I had been referencing. 

It doesn't state what is needed to create a draft work item.

permanent link
Eric Jodet (6.3k5111120) | answered Feb 20 '14, 8:17 a.m.
 Hello Brian,
Donald is right - 500 means a server error that you should be able to find in the cmm log.

More on the topic:

Hope it helps,

Bryan Perino commented Feb 20 '14, 1:37 p.m.

 Thanks Eric.

I have looked through the documentation and don't see anything glaringly obvious. Here are the headers that I am sending with the request

OSLC-Core-Version 2.0
accept application/json
Content-type application/json

and here is the snipet from the log file.

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.