用Java更新Trello卡的自定义字段
我试图更新Trello卡中的自定义字段,但在响应中得到用Java更新Trello卡的自定义字段,java,http-post,trello,Java,Http Post,Trello,我试图更新Trello卡中的自定义字段,但在响应中得到404 到目前为止,我所尝试的: try (CloseableHttpClient httpClient = HttpClients.createDefault()) { MyUtils myUtils = new MyUtils(); HttpPost post = new HttpPost("https://api.trello.com/1/cards/" + CARD_ID + &q
404
到目前为止,我所尝试的:
try (CloseableHttpClient httpClient = HttpClients.createDefault()) {
MyUtils myUtils = new MyUtils();
HttpPost post = new HttpPost("https://api.trello.com/1/cards/" + CARD_ID + "/customField/" + CUSTOMFIELD_ID + "/item");
List<NameValuePair> urlParameters = new ArrayList<>();
urlParameters.add(new BasicNameValuePair("key", TRELLO_KEY));
urlParameters.add(new BasicNameValuePair("token", TRELLO_TOKEN));
urlParameters.add(new BasicNameValuePair("value", "{'text': 'this is a new string'}"));
post.setEntity(new UrlEncodedFormEntity(urlParameters, "UTF-8"));
try (CloseableHttpResponse response = httpClient.execute(post)) {
int responseCode = response.getStatusLine().getStatusCode();
System.out.println("response from customField = " + responseCode);
}
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
} catch (IOException | ParseException e) {
e.printStackTrace();
}
及
我错过了什么?
多谢各位
urlParameters.add(new BasicNameValuePair("text", "hello"));
urlParameters.add(new BasicNameValuePair("value", "hello"));