ForumsSearch



Search results for "Posted by ajimenez"
Author Message
ajimenez

Posted Jul 24, 2019 in: How to edit tasks with API 3?
Score: 1
  • ajimenez
  • Posted: Jul 24, 2019
  • Score: 1
I got code sample from Github and everything were ok, but when I began to try edit tasks, I had receive error:

errorCode: 611,
errorDesc: "Malformed request."

function postResource($resource_url,$access_token,$post) {
$url = $resource_url;
if(is_array($post)) {
$url .= "?access_token=".$access_token;
} else {
$post.= "&access_token=".$access_token;
}
$ci = curl_init();
curl_setopt($ci, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ci, CURLOPT_POST, TRUE);
curl_setopt($ci, CURLOPT_POSTFIELDS, $post);
curl_setopt($ci, CURLOPT_URL, $url);
$response = curl_exec($ci);
curl_close ($ci);
return $response;
}


$link = mysqli_connect($config["DB_HOSTNAME"], $config["DB_USERNAME"], $config["DB_PASSWORD"], $config["DB_DATABASE"]);
$query ="SELECT * FROM Toodledo ORDER BY id DESC LIMIT 1";
$res=mysqli_query($link, $query);
$tokens=$res->fetch_array(MYSQLI_ASSOC);
$params=[
"tasks"=>[
[
"id"=>"269656975",
"status"=>"2"
],
['id'=>'269657909','note'=>'wow']
]
];

$data = postResource("http://api.toodledo.com/3/tasks/edit.php",$tokens["access_token"],$params);

echo "<pre>";
echo print_r($data, 1);
echo "</pre>";