asana でタスクを作成する次のコードがあります。
String data = "{" + " \"data\": {"
+ "\"workspace\":4661999437107,"
+ "\"name\": \"crmit solutions\","
+ "\"notes\": \"NOTES_ABOUT_TASK_GO_HERE\","
+ "\"assignee\": \"ravi.khare@crmit.com\"" + "}"
// + " \"options\": {" + " \"fields\": \"name\"}"
+ "}";
HttpClient client = new HttpClient();
client.getParams().setAuthenticationPreemptive(true);
client.getParams().setParameter("http.useragent", "Test Client");
client.getState().setCredentials(
new AuthScope("app.asana.com", 443, "realm"),
new UsernamePasswordCredentials(
"1k3qqT7O.RVRyxHdHRLiYSH710c6NpVl", ""));
BufferedReader br = null;
PostMethod method = new PostMethod(
"https://app.asana.com/api/1.0/tasks");
method.setDoAuthentication(true);
try {
method.setRequestBody(data);
int returnCode = client.executeMethod(method);
System.out.println("Return code: " + returnCode);
br = new BufferedReader(new InputStreamReader(
method.getResponseBodyAsStream()));
String readLine;
while (((readLine = br.readLine()) != null)) {
System.out.println(readLine);
}
} catch (Exception e) {
System.out.println(e.getMessage());
} finally {
method.releaseConnection();
if (br != null)
try {
br.close();
} catch (Exception fe) {
System.err.println(fe);
}
}
しかし、 Return code: 400 {"errors":[{"message":"workspace: Not the correct type"}]} というエラーが表示されます
助けてください !!