We are trying to upload a document to a task consuming REST following below procedure through JAVA
Uploads and Documents
API 2.0 allows users to upload documents through the following API URL:
POST /attask/api/upload
The API expects the content type to be multipart/form-data. The parameter name for the file must be uploadedFile. The server will return the following JSON data:
{ "handle": "4c7c08fa0000002ff924e298ee148df4" }
The handle can then be used when creating an Workfront Document. To create an Workfront Document you will post to to the following URL:
POST /attask/api/document?updates={ name: aFileName, handle: abc...123, (handle from the file upload) docObjCode: PROJ, (or TASK, OPTASK, etc) objID: abc...123, currentVersion:{version:v1.0,fileName:aFileName} }
Map
map = new HashMap();
map.put("Content-Type", "multipart/form-data"); map.put("name", new File("test.txt")); JSONObject handle = client.post("upload", map); System.out.println("Handle" + handle.getString("handle") );
we are getting filenotfound exception. If anybody implemented file upload to a task in project through JAVA. Can you please share some insight? Thanks in advance