1

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}
           }

Below is the java sample code I am trying to consume rest api for upload

 Map<String, Object> map = new HashMap<String, Object>();
 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

Imran Saeed
  • 3,414
  • 1
  • 16
  • 27
vssrnr
  • 19
  • 1
  • 10
  • 2
    What does this have to do with Adobe Experience Manager? – Jens May 02 '17 at 09:43
  • we are trying to call the REST api's from AEM...anyway not much related though..we use Emberjs for front end and we are calling the servlet from ember and consuming the REST. – vssrnr May 02 '17 at 14:07

0 Answers0