I am trying to upload a file to an issue under a project[Workfront] using Java Client to consume REST API's.
https://github.com/Workfront/api-bootcamp/blob/master/src/com/workfront/api/StreamClient.java
Above api-bootcamp has a client to upload a file( upload(File file) and upload(String url)).
But how do I attach a file to a particular issue/project and upload a file in Java?
Map<String, Object> map = new HashMap<String, Object>();
map.clear();
map.put("projectID", "XXXXXXXX");
JSONObject jb = client.upload(f); ??
//TODO : How do I use client to upload a file. I am getting
illegalargument exception
System.out.println(""+ jb);
Attaching files to projects in Workfront is a two-step process. First, you must upload the file. I'm not familiar with the 3rd party API you're using, but I'm assuming that you don't have any issues with the actual file upload.
When you upload a file, you are given its UUID. Take that UUID and POST it to
/attask/api/document?updates={name:<filename>,handle:<uuid>,docObjCode:TASK,objID:<task UUID>,currentVersion:{version:v1.0,fileName:<filename>}}