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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,455,831
Community Members
 
Community Events
176
Community Groups

update customField curl php

Edited

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? 

 

1 answer

1 accepted

2 votes
Answer accepted

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.

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events