AnsweredAssumed Answered

how to use REST API to create a attachment for a task

Question asked by roundmonkey on Jan 28, 2014
Latest reply on Feb 7, 2014 by roundmonkey
Hi,

I used following codes to upload a attachment on a task, but I always got "400: attachment name is required", I really don't know what I missed, pls help.

FileBody fb=mew FileBody(new File("d:/test.xlsx"));

HttpPost httppost = new HttpPost(url);

MultipartEntity reqEntity = new MultipartEntity();

reqEntity.addPart("name", fb);

reqEntity.addPart("name", "test.xlsx");

httppost.setEntity(reqEntity);

java.lang.Exception: createAttachmentByTaskId for task[9505] error, cause: {"errorMessage":"Attachment name is required.","statusCode":400}

Outcomes