I was wondering if you've had any success performing a PUT request on one of your exposed api methods (update workspace in this case) using Java EE.
I currently have the following snippet but am getting a 400. For the data variable, I have tried probably every single permutation of where to place double quotes, what to encode, and also have tried JSON.
String data = URLEncoder.encode("name=My Sandbox", "UTF-8")
URL url = new URL("https://app.asana.com/api/1.0/workspaces/7**********2");
HttpsURLConnection conn = (HttpsURLConnection)url.openConnection();
conn.setRequestMethod("PUT");
String login = "dm**********************v8:";
String encodedLogin = new BASE64Encoder().encode(login.getBytes());
conn.setRequestProperty("Authorization", "Basic " + encodedLogin);
OutputStreamWriter wr = null;
conn.setDoOutput(true);
wr = new OutputStreamWriter(conn.getOutputStream());
wr.write(data);
wr.flush();
BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));
StringBuffer sb = new StringBuffer();
String line;
while ((line = rd.readLine()) != null) {
sb.append(line);
}
wr.close();
rd.close();