Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Add attachment files when creating a card through REST API in JAVA

Yaylitzis April 30, 2020

Hello,

I have managed to create a card from my web application (in JAVA)

try (CloseableHttpClient httpClient = HttpClients.createDefault()) {

HttpPost post = new HttpPost("https://api.trello.com/1/cards");

List<NameValuePair> urlParameters = new ArrayList<>();
urlParameters.add(new BasicNameValuePair("key", "#######"));
urlParameters.add(new BasicNameValuePair("token", "#######"));
urlParameters.add(new BasicNameValuePair("idList", "#######"));
urlParameters.add(new BasicNameValuePair("name", "my title"));
urlParameters.add(new BasicNameValuePair("desc", "my description"));
urlParameters.add(new BasicNameValuePair("due", "2020-08-01"));

post.setEntity(new UrlEncodedFormEntity(urlParameters, "UTF-8"));

try (CloseableHttpResponse response = httpClient.execute(post)) {
responseCode = response.getStatusLine().getStatusCode();
}
}

 

Do you have an example how can I attach also images in the card in JAVA?

 

1 answer

0 votes
Iain Dooley
Community Champion
April 30, 2020

@Yaylitzis I've never been able to make actual file uploads work, it seems that even natively file uploads are actually just represented as links. 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events