Hello,
I’ m trying to upload files with bonita rest API and I had two problems:
- To test rest Api, in chrome I make login in bonita portal, and created a case.
In the same browser i open a new tab and in postman extension I build a request like this
url = http://localhost:8080/bonita/API/bpm/caseDocument:
data = {“caseId”:“29”,“file”:“C:\flexitex2.jpg”,“name”:“flexitex2”,“description”:“draft”}
where my case id was = 29.
The server send back that response
{
“id”: “3”,
“creationDate”: “2015-01-14 14:42:16.237”,
“author”: “25”,
“index”: “-1”,
“contentMimetype”: “”,
“caseId”: “29”,
“description”: “draft”,
“name”: “flexitex2”,
“fileName”: “”,
“isInternal”: “true”,
“submittedBy”: “25”,
“url”: “documentDownload?fileName=null&contentStorageId=3”,
“contentStorageId”: “3”,
“version”: “1”
}
The attr content type and fileName is empty.
What I am doing wrong here?
- In widget html in one form I have this script
$.post( “http://localhost:8080/bonita/API/bpm/caseDocument”, JSON.stringify( {“caseId”: caseId, “file”: “C:\flexitex1.PNG”, “name”: “flexitex1”, “description”: “draft”}), });
this scripts runs when i click in one specific button.
The server send back this response was:
exception: “class java.lang.NullPointerException”
message: “”
stacktrace: [“org.bonitasoft.web.toolkit.client.common.json.JSonItemReader.parseItem(JSonItemReader.java:212)”,…]
0: “org.bonitasoft.web.toolkit.client.common.json.JSonItemReader.parseItem(JSonItemReader.java:212)”
1: “org.bonitasoft.web.toolkit.client.common.json.JSonItemReader.parseItem(JSonItemReader.java:198)”
2: “org.bonitasoft.web.toolkit.client.common.json.JSonItemReader.parseItem(JSonItemReader.java:188)”
3: “org.bonitasoft.web.toolkit.client.common.json.JSonItemReader.parseItem(JSonItemReader.java:168)”
4: “org.bonitasoft.web.rest.server.framework.APIServletCall.getJSonStreamAsItem(APIServletCall.java:129)”
What I am doing wrong in this script?
Can anyone help me with this call?
Thanks in advance and sorry for my english.