It's all about the answers!

Ask a question

Creating Draft Work Item returns 500


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

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

	{  
	
"title":"A test defect",  
"rtc_cm:type":   
{  
"rdf:resource":"https://jazz01.<domain>.com/ccm04\/oslc/types/_eZ3Z8KuOEeKo-JGDY--3wg\/defect"  
     }   }

However, I am getting the following error message back

	{"prefixes":{"oslc":"http:\/\/open-services.net\/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. 

Comments
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

6 answers



permanent link
Eric Jodet (6.3k5100120) | answered Feb 20 '14, 8:17 a.m.
JAZZ DEVELOPER
 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:
https://jazz.net/wiki/bin/view/Main/WorkItemAPIsForOSLCCM20
and
https://jazz.net/library/article/1001#consuming_oslc_services

Hope it helps,
Eric



Comments
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.


permanent link
Eric Jodet (6.3k5100120) | answered Feb 21 '14, 2:11 a.m.
JAZZ DEVELOPER
 Hello Brian,
log shows:
  1. org.eclipse.core.runtime.AssertionFailedException: null argument:
  2.         at org.eclipse.core.runtime.Assert.isNotNull(Assert.java:85)
  3.         at org.eclipse.core.runtime.Assert.isNotNull(Assert.java:73)
  4.         at com.ibm.team.workitem.common.internal.workflow.StateGroupRegistry.getStateGroup(StateGroupRegistry.java:
  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\/com.ibm.team.workitem.taskWorkflow\/3",
        "rdf:type": [
            {
                "rdf:resource": "http:\/\/jazz.net\/xmlns\/prod\/jazz\/rtc\/cm\/1.0\/Status"
            }
        ]
    },
		

Comments
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.3k5100120) | answered Feb 25 '14, 12:38 p.m.
JAZZ DEVELOPER
  Bryan,
I was about to give you this reference, but was stuck with something else.
Sorry.
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
Donald Nong (14.4k213) | 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.

Comments
Alex Fitzpatrick commented May 20 '14, 4:15 p.m.
JAZZ DEVELOPER
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.3k5100120) | answered Feb 26 '14, 9:10 a.m.
JAZZ DEVELOPER
 Brian,
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.

Thanks,
Eric

Comments
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.
JAZZ DEVELOPER

 yes - you may open a formal ticket - aka PMR - https://jazz.net/help/support/


Eric


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

eg.

{
    "dc:type":
    {
        "rdf:resource":"https:\/\/mycroft:9443\/ccm\/oslc\/types\/_bhBPQNVBEeOa4Jat-pHN6g\/defect"
    }
}

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

eg:
https://mycroft:9443/ccm/oslc/contexts/_bhBPQNVBEeOa4Jat-pHN6g/workitems



Comments
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": "http://jazz.net/xmlns/prod/jazz/rtc/cm/1.0/Type" } ], "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.
JAZZ DEVELOPER
With out of the box projects, this also works.

{
    "dc:type":"defect"
}

 


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.

'dc:type':'task'
'rtc_cm:type':'task'
'rtc_cm:type':{'rdf:resource':'fullURL/task'}
'dc:type':{'rdf:resource':'fullURL/task'}


Any ideas?

Your answer


Register or to post your answer.