You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
Hi all,
I'm stucked very well. Every GET request works fine, but I can't set any customFiled value with php curl.
My first problem, that I cant achive any answer from the server, so I absolutely dont know where do I something wrong. (All my GET requests works fine)
My code:
$data = array(
'idValue' => $cflistdvalueid,
'key' => $userDetails->t_key,
'token' => $userDetails->t_token
);
$headers = array(
"Content-Type: application/json",
);
$domain = "https://api.trello.com";
$request = "/1/card/".$cid."/customField/".$cfid."/item";
//variables checked with GET request, id-s are OK.
Function:
$ch = curl_init();
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
curl_setopt($ch, CURLOPT_URL, $domain.$request);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
return(curl_exec($ch));
curl_close($ch);
Called full link:
https://api.trello.com/1/card/62a832b4f852XXXXX1341f99/customField/62bbf364f1d04c8XXXXXX5a8/item
I'v got nothing back from the server, return is empty. Nor an error message, returns NULL... :(
Can you please help me, what I'm doing wrong?
Solved!
(But still no answer from the server.....)
I changed $data like this:
$data = '{"idValue": "'.$cflistdvalueid.'","key": "'.$userDetails->t_key.'","token": "'.$userDetails->t_token.'"}';
And in the function i deleted http_build_query, so the CURLOP_POSTFILEDS line looks like this:
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
It works. Even I got nothing from the server back.
Thanks.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.