start a case with REST API and JQuery

Hi,
I’m trying to start a case with REST API, but I have an exception:

"exception": "class java.lang.NullPointerException", "message": "", "stacktrace": [ "org.bonitasoft.web.toolkit.client.common.json.JSonItemReader.parseItem(JSonItemReader.java:212)", "org.bonitasoft.web.toolkit.client.common.json.JSonItemReader.parseItem(JSonItemReader.java:198)", "org.bonitasoft.web.toolkit.client.common.json.JSonItemReader.parseItem(JSonItemReader.java:188)", "org.bonitasoft.web.toolkit.client.common.json.JSonItemReader.parseItem(JSonItemReader.java:168)", "org.bonitasoft.web.rest.server.framework.APIServletCall.getJSonStreamAsItem(APIServletCall.java:99)", "org.bonitasoft.web.rest.server.framework.APIServletCall.doPost(APIServletCall.java:187)", "org.bonitasoft.web.toolkit.server.servlet.ToolkitHttpServlet.doPost(ToolkitHttpServlet.java:188)", "javax.servlet.http.HttpServlet.service(HttpServlet.java:643)", "org.bonitasoft.web.toolkit.server.servlet.ToolkitHttpServlet.service(ToolkitHttpServlet.java:75)", "javax.servlet.http.HttpServlet.service(HttpServlet.java:723)", "org.bonitasoft.web.toolkit.server.servlet.ToolkitHttpServlet.service(ToolkitHttpServlet.java:226)", "org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)", "org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)", "org.bonitasoft.console.common.server.login.filter.AbstractAuthorizationFilter.doFilter(AbstractAuthorizationFilter.java:60)", "org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)", "org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)", "org.bonitasoft.console.common.server.login.filter.AbstractAuthorizationFilter.doFilter(AbstractAuthorizationFilter.java:60)", "org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)", "org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)", "com.thetransactioncompany.cors.CORSFilter.doFilter(CORSFilter.java:165)", "com.thetransactioncompany.cors.CORSFilter.doFilter(CORSFilter.java:239)", "org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)", "org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)", "org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)", "org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)", "org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)", "org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)", "org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)", "org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)", "org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:861)", "org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:606)", "org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)", "java.lang.Thread.run(Unknown Source)"

My code :

var processData = {‘processDefinitionId’: 7042233061977589234,‘variables’:[{‘name’:‘homeid’,‘value’:‘4546’},{‘name’:‘address’,‘value’:‘sgfeg’}]};
$.ajax({
type : “POST”,
url : ‘http://localhost:8080/bonita/API/bpm/case/’,
dataType: “json”,
contentType: “application/x-www-form-urlencoded”,
data: processData,
success : function(data, status) {
console.log(data);
},
error : function(data){
console.log(data);
}
});

I solved this problem:

		var processData = {'processDefinitionId': '7216622050483761810','variables':[{'name':'home','value':'sfgs'},{'name':'addr','value':'234234'}]};
		$.ajax({
			type : "POST",
			url : 'http://localhost:8080/bonita/API/bpm/case',
			dataType: "json", 
			contentType: "application/json", 
			data: JSON.stringify(processData),
			success : function(data, status) {
				console.log(data);
			},
			error : function(data){
				console.log(data);
			}	
		});

Hi,

Try to set the processDefinitionId value as string ?

Thanks,
I resolved!

Manolo