upload and download files REST API

Hi.
I´ve intent to create a instance of process (upload and download) using rest API.

http://localhost:8080/bonita/API/bpm/case/
params: (dataType:json, contenType:application/json)

{ “processDefinitionId”: 7641499513921091240, “variables”: [“myDocumentContract”: { “filename”: “07749533.pdf”, “tempPath”: “tmp_8964658850826963659.pdf”, “contentType”: “application/pdf” }]}

But it doesn´t work

{
“exception”: “class java.lang.IllegalArgumentException”,
“message”: “Can’t parse JSon”,
“stacktrace”: [
“org.bonitasoft.web.rest.server.framework.json.JSonSimpleDeserializer._unserializeTree(JSonSimpleDeserializer.java:62)”,
“org.bonitasoft.web.toolkit.client.common.json.JSonItemReader.parseItem(JSonItemReader.java:178)”,
“org.bonitasoft.web.toolkit.client.common.json.JSonItemReader.parseItem(JSonItemReader.java:168)”,
“org.bonitasoft.web.rest.server.framework.APIServletCall.getJSonStreamAsItem(APIServletCall.java:123)”,
“org.bonitasoft.web.rest.server.framework.APIServletCall.doPost(APIServletCall.java:212)”,
“org.bonitasoft.web.toolkit.server.servlet.ToolkitHttpServlet.doPost(ToolkitHttpServlet.java:188)”,
“javax.servlet.http.HttpServlet.service(HttpServlet.java:650)”,
“org.bonitasoft.web.toolkit.server.servlet.ToolkitHttpServlet.service(ToolkitHttpServlet.java:75)”,
“javax.servlet.http.HttpServlet.service(HttpServlet.java:731)”,
“org.bonitasoft.web.toolkit.server.servlet.ToolkitHttpServlet.service(ToolkitHttpServlet.java:226)”,
“org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)”,
“org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)”,
“org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)”,
“org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)”,
“org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)”,
“org.tuckey.web.filters.urlrewrite.RuleChain.handleRewrite(RuleChain.java:176)”,
“org.tuckey.web.filters.urlrewrite.RuleChain.doRules(RuleChain.java:145)”,
“org.tuckey.web.filters.urlrewrite.UrlRewriter.processRequest(UrlRewriter.java:92)”,
“org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:394)”,
“org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)”,
“org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)”,
“org.bonitasoft.console.common.server.login.filter.AbstractAuthorizationFilter.doFilter(AbstractAuthorizationFilter.java:60)”,
“org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)”,
“org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)”,
“org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:747)”,
“org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:485)”,
“org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:410)”,
“org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:337)”,
“org.tuckey.web.filters.urlrewrite.NormalRewrittenUrl.doRewrite(NormalRewrittenUrl.java:213)”,
“org.tuckey.web.filters.urlrewrite.RuleChain.handleRewrite(RuleChain.java:171)”,
“org.tuckey.web.filters.urlrewrite.RuleChain.doRules(RuleChain.java:145)”,
“org.tuckey.web.filters.urlrewrite.UrlRewriter.processRequest(UrlRewriter.java:92)”,
“org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:394)”,
“org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)”,
“org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)”,
“org.bonitasoft.console.common.server.login.filter.AbstractAuthorizationFilter.doFilter(AbstractAuthorizationFilter.java:60)”,
“org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)”,
“org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)”,
“org.bonitasoft.console.common.server.login.filter.AbstractAuthorizationFilter.doFilter(AbstractAuthorizationFilter.java:60)”,
“org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)”,
“org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)”,
“org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)”,
“org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)”,
“org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:505)”,
“org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169)”,
“org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)”,
“org.bonitasoft.console.security.SessionFixationValve.invoke(SessionFixationValve.java:77)”,
“org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)”,
“org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:423)”,
“org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1079)”,
“org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:625)”,
“org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316)”,
“java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)”,
“java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)”,
“org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)”,
“java.lang.Thread.run(Thread.java:745)”
],
“cause”: {
“exception”: “class org.json.simple.parser.ParseException”,
“message”: “”,
“stacktrace”: [
“org.json.simple.parser.JSONParser.parse(Unknown Source)”,
“org.json.simple.parser.JSONParser.parse(Unknown Source)”,
“org.json.simple.parser.JSONParser.parse(Unknown Source)”,
“org.bonitasoft.web.rest.server.framework.json.JSonSimpleDeserializer._unserializeTree(JSonSimpleDeserializer.java:60)”,
“org.bonitasoft.web.toolkit.client.common.json.JSonItemReader.parseItem(JSonItemReader.java:178)”,
“org.bonitasoft.web.toolkit.client.common.json.JSonItemReader.parseItem(JSonItemReader.java:168)”,
“org.bonitasoft.web.rest.server.framework.APIServletCall.getJSonStreamAsItem(APIServletCall.java:123)”,
“org.bonitasoft.web.rest.server.framework.APIServletCall.doPost(APIServletCall.java:212)”,
“org.bonitasoft.web.toolkit.server.servlet.ToolkitHttpServlet.doPost(ToolkitHttpServlet.java:188)”,
“javax.servlet.http.HttpServlet.service(HttpServlet.java:650)”,
“org.bonitasoft.web.toolkit.server.servlet.ToolkitHttpServlet.service(ToolkitHttpServlet.java:75)”,
“javax.servlet.http.HttpServlet.service(HttpServlet.java:731)”,
“org.bonitasoft.web.toolkit.server.servlet.ToolkitHttpServlet.service(ToolkitHttpServlet.java:226)”,
“org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)”,
“org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)”,
“org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)”,
“org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)”,
“org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)”,
“org.tuckey.web.filters.urlrewrite.RuleChain.handleRewrite(RuleChain.java:176)”,
“org.tuckey.web.filters.urlrewrite.RuleChain.doRules(RuleChain.java:145)”,
“org.tuckey.web.filters.urlrewrite.UrlRewriter.processRequest(UrlRewriter.java:92)”,
“org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:394)”,
“org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)”,
“org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)”,
“org.bonitasoft.console.common.server.login.filter.AbstractAuthorizationFilter.doFilter(AbstractAuthorizationFilter.java:60)”,
“org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)”,
“org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)”,
“org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:747)”,
“org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:485)”,
“org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:410)”,
“org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:337)”,
“org.tuckey.web.filters.urlrewrite.NormalRewrittenUrl.doRewrite(NormalRewrittenUrl.java:213)”,
“org.tuckey.web.filters.urlrewrite.RuleChain.handleRewrite(RuleChain.java:171)”,
“org.tuckey.web.filters.urlrewrite.RuleChain.doRules(RuleChain.java:145)”,
“org.tuckey.web.filters.urlrewrite.UrlRewriter.processRequest(UrlRewriter.java:92)”,
“org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:394)”,
“org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)”,
“org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)”,
“org.bonitasoft.console.common.server.login.filter.AbstractAuthorizationFilter.doFilter(AbstractAuthorizationFilter.java:60)”,
“org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)”,
“org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)”,
“org.bonitasoft.console.common.server.login.filter.AbstractAuthorizationFilter.doFilter(AbstractAuthorizationFilter.java:60)”,
“org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)”,
“org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)”,
“org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)”,
“org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)”,
“org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:505)”,
“org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169)”,
“org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)”,
“org.bonitasoft.console.security.SessionFixationValve.invoke(SessionFixationValve.java:77)”,
“org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)”,
“org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:423)”,
“org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1079)”,
“org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:625)”,
“org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316)”,
“java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)”,
“java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)”,
“org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)”,
“java.lang.Thread.run(Thread.java:745)”
]
}
}

Thanks for your help !

I forget says that I´ve deleted the multiple Documents load function.

Hello hcastellanos,

You should do a POST on this url :
http://localhost:8080/bonita/API/bpm/process/{{processDefinitionId}}/instantiation

with a body content that matches your process contract :

{
"myDocumentContract": { 
"filename": "07749533.pdf", 
"tempPath": "tmp_8964658850826963659.pdf", 
"contentType": "application/pdf" 
}
}

if you use the ui designer, you can use the button widget, with action “POST”. in that case, the url to call is the one i specified above, and the data sent on click is the json object that matches your contract.

Cheers,

Mehdi Kettani

Hi Mehdi.

I just sent the request
http://localhost:8080/bonita/API/bpm/case/?processDefinitionId=8520053175898811975&instantiation=1000
body:

{
“myDocumentContract”: {
“filename”: “07749533.pdf”,
“tempPath”: “tmp_8964658850826963659.pdf”,
“contentType”: “application/pdf”
}
}

but it doesn´t works…

{
“exception”: “class java.lang.NullPointerException”,
“message”: “”,
“stacktrace”: [
“org.bonitasoft.web.rest.server.datastore.bpm.cases.CaseSarter.(CaseSarter.java:50)”,
“org.bonitasoft.web.rest.server.datastore.bpm.cases.CaseDatastore.add(CaseDatastore.java:166)”,
“org.bonitasoft.web.rest.server.api.bpm.cases.APICase.add(APICase.java:53)”,
“org.bonitasoft.web.rest.server.api.bpm.cases.APICase.add(APICase.java:44)”,
“org.bonitasoft.web.rest.server.framework.API.runAdd(API.java:150)”,
“org.bonitasoft.web.rest.server.framework.APIServletCall.doPost(APIServletCall.java:213)”,
“org.bonitasoft.web.toolkit.server.servlet.ToolkitHttpServlet.doPost(ToolkitHttpServlet.java:188)”,
“javax.servlet.http.HttpServlet.service(HttpServlet.java:650)”,
“org.bonitasoft.web.toolkit.server.servlet.ToolkitHttpServlet.service(ToolkitHttpServlet.java:75)”,
“javax.servlet.http.HttpServlet.service(HttpServlet.java:731)”,
“org.bonitasoft.web.toolkit.server.servlet.ToolkitHttpServlet.service(ToolkitHttpServlet.java:226)”,
“org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)”,
“org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)”,
“org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)”,
“org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)”,
“org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)”,
“org.tuckey.web.filters.urlrewrite.RuleChain.handleRewrite(RuleChain.java:176)”,
“org.tuckey.web.filters.urlrewrite.RuleChain.doRules(RuleChain.java:145)”,
“org.tuckey.web.filters.urlrewrite.UrlRewriter.processRequest(UrlRewriter.java:92)”,
“org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:394)”,
“org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)”,
“org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)”,
“org.bonitasoft.console.common.server.login.filter.AbstractAuthorizationFilter.doFilter(AbstractAuthorizationFilter.java:60)”,
“org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)”,
“org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)”,
“org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:747)”,
“org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:485)”,
“org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:410)”,
“org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:337)”,
“org.tuckey.web.filters.urlrewrite.NormalRewrittenUrl.doRewrite(NormalRewrittenUrl.java:213)”,
“org.tuckey.web.filters.urlrewrite.RuleChain.handleRewrite(RuleChain.java:171)”,
“org.tuckey.web.filters.urlrewrite.RuleChain.doRules(RuleChain.java:145)”,
“org.tuckey.web.filters.urlrewrite.UrlRewriter.processRequest(UrlRewriter.java:92)”,
“org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:394)”,
“org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)”,
“org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)”,
“org.bonitasoft.console.common.server.login.filter.AbstractAuthorizationFilter.doFilter(AbstractAuthorizationFilter.java:60)”,
“org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)”,
“org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)”,
“org.bonitasoft.console.common.server.login.filter.AbstractAuthorizationFilter.doFilter(AbstractAuthorizationFilter.java:60)”,
“org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)”,
“org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)”,
“org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)”,
“org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)”,
“org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:505)”,
“org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169)”,
“org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)”,
“org.bonitasoft.console.security.SessionFixationValve.invoke(SessionFixationValve.java:77)”,
“org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)”,
“org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:423)”,
“org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1079)”,
“org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:625)”,
“org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316)”,
“java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)”,
“java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)”,
“org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)”,
“java.lang.Thread.run(Thread.java:745)”
]
}

Thanks for your help

the url doesnt look like what i sent :

it should be :

http://localhost:8080/bonita/API/bpm/process/8520053175898811975/instantiation

try first with a process that doesnt require a file as contract input.

Hello

How can I send the file to the "tempPath" folder. Because when I mail the code it tells me that the archive is missing and it's because I haven't put it.

I just sent the request using 

Post      http://127.0.0.1:35139/bonita/API/bpm/process/8005671248051857614/instantiation

with the body:
{
"myDocumentContract": {
"filename": "07749533.pdf",
"tempPath": "tmp_8964658850826963659.pdf",
"contentType": "application/pdf"
}
}

 

Response

{

    "exception": "class java.io.FileNotFoundException",

    "message": "File Not Found"

}

Hi Mehdi.

I just sent the request using http://localhost:8080/bonita/API/bpm/case/?processDefinitionId=8520053175898811975&instantiation=1000

with the body:
{
“myDocumentContract”: {
“filename”: “07749533.pdf”,
“tempPath”: “tmp_8964658850826963659.pdf”,
“contentType”: “application/pdf”
}
}

but it doesn´t works

{
“exception”: “class java.lang.NullPointerException”,
“message”: “”,
“stacktrace”: [
“org.bonitasoft.web.rest.server.datastore.bpm.cases.CaseSarter.(CaseSarter.java:50)”,
“org.bonitasoft.web.rest.server.datastore.bpm.cases.CaseDatastore.add(CaseDatastore.java:166)”,
“org.bonitasoft.web.rest.server.api.bpm.cases.APICase.add(APICase.java:53)”,
“org.bonitasoft.web.rest.server.api.bpm.cases.APICase.add(APICase.java:44)”,
“org.bonitasoft.web.rest.server.framework.API.runAdd(API.java:150)”,
“org.bonitasoft.web.rest.server.framework.APIServletCall.doPost(APIServletCall.java:213)”,
“org.bonitasoft.web.toolkit.server.servlet.ToolkitHttpServlet.doPost(ToolkitHttpServlet.java:188)”,
“javax.servlet.http.HttpServlet.service(HttpServlet.java:650)”,
“org.bonitasoft.web.toolkit.server.servlet.ToolkitHttpServlet.service(ToolkitHttpServlet.java:75)”,
“javax.servlet.http.HttpServlet.service(HttpServlet.java:731)”,
“org.bonitasoft.web.toolkit.server.servlet.ToolkitHttpServlet.service(ToolkitHttpServlet.java:226)”,
“org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)”,
“org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)”,
“org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)”,
“org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)”,
“org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)”,
“org.tuckey.web.filters.urlrewrite.RuleChain.handleRewrite(RuleChain.java:176)”,
“org.tuckey.web.filters.urlrewrite.RuleChain.doRules(RuleChain.java:145)”,
“org.tuckey.web.filters.urlrewrite.UrlRewriter.processRequest(UrlRewriter.java:92)”,
“org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:394)”,
“org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)”,
“org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)”,
“org.bonitasoft.console.common.server.login.filter.AbstractAuthorizationFilter.doFilter(AbstractAuthorizationFilter.java:60)”,
“org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)”,
“org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)”,
“org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:747)”,
“org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:485)”,
“org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:410)”,
“org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:337)”,
“org.tuckey.web.filters.urlrewrite.NormalRewrittenUrl.doRewrite(NormalRewrittenUrl.java:213)”,
“org.tuckey.web.filters.urlrewrite.RuleChain.handleRewrite(RuleChain.java:171)”,
“org.tuckey.web.filters.urlrewrite.RuleChain.doRules(RuleChain.java:145)”,
“org.tuckey.web.filters.urlrewrite.UrlRewriter.processRequest(UrlRewriter.java:92)”,
“org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:394)”,
“org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)”,
“org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)”,
“org.bonitasoft.console.common.server.login.filter.AbstractAuthorizationFilter.doFilter(AbstractAuthorizationFilter.java:60)”,
“org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)”,
“org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)”,
“org.bonitasoft.console.common.server.login.filter.AbstractAuthorizationFilter.doFilter(AbstractAuthorizationFilter.java:60)”,
“org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)”,
“org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)”,
“org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)”,
“org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)”,
“org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:505)”,
“org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169)”,
“org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)”,
“org.bonitasoft.console.security.SessionFixationValve.invoke(SessionFixationValve.java:77)”,
“org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)”,
“org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:423)”,
“org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1079)”,
“org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:625)”,
“org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316)”,
“java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)”,
“java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)”,
“org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)”,
“java.lang.Thread.run(Thread.java:745)”
]
}
Thanks

Hi Medhi.

I tried with your propossal.
the new trace is:

{
“code”: 415,
“contactEmail”: null,
“description”: “The server is refusing to service the request because the entity of the request is in a format not supported by the requested resource for the requested method”,
“homeRef”: “/”,
“reasonPhrase”: “Unsupported Media Type”,
“uri”: “http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.16
}
I´m trying to use header as contenType: application/json and dataType: json

I tried with other process and it´s running sucessfull

Medhi, I trying other focus using http://localhost:8080/bonita/API/bpm/caseDocument
when i Sent the file to case, it returns
{
“submittedBy”: “4”,
“fileName”: “document_1.jpg”,
“author”: “4”,
“contentStorageId”: “603”,
“description”: “draft”,
“index”: “-1”,
“creationDate”: “2018-02-23 08:51:32.337”,
“version”: “1”,
“contentMimetype”: “image/jpeg”,
“url”: “documentDownload?fileName=document_1.jpg&contentStorageId=603”,
“isInternal”: “true”,
“caseId”: “8002”,
“name”: “Doc 1”,
“id”: “603”
}
But it like to show the document in the document panel of the case and it doesn´t show the file.

Thanks.

Hi hcastellanos,

it means that your document was correctly added. you have to use a link widget to allow users to download your document (using the document url).

Cheers,

Mehdi