Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How to update custom field by using Trello API?

Денис Диан May 5, 2021

I am trying to update custom field, but it doesnt work, the documentation is little bit small about this, does somebody can help me with that?

My code 

$trello_key          = 'xxx';

$trello_member_token = 'xxx';

$valueArr = array('text' => '222');

$value = json_encode($valueArr);

$url = 'https://api.trello.com/1/cards/608bb4a0ca7cf62d9f0cbce9/customField/608ab6027d7a2832d8c9d5dd/item';

$fields='token='.$trello_member_token;

$fields.='&key='.$trello_key;

$fields.='&value='.$value;

function trello_post($url, $fields{    

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, $url); 

curl_setopt($ch, CURLOPT_POSTFIELDS, $fields);

curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)");

curl_setopt($ch, CURLOPT_HEADER, 0);

curl_setopt($ch, CURLINFO_HEADER_OUT, true); 

curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

curl_setopt($ch, CURLOPT_TIMEOUT, 0);

curl_setopt($ch, CURLOPT_PUT, 1);

curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);

$output = curl_exec($ch);

curl_close($ch); 

return json_decode($output);

}

$result = trello_post($url, $fields);

1 answer

0 votes
Vero Rivas
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 20, 2021

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events