1

i want to use Asana-Api by using PHP-Asana (https://github.com/Asana/php-asana).

I'm connecting via $client = Asana\Client::accessToken(); That works.

Creating a Project or Task is also working.

$project = $client->projects->createInWorkspace($workspace, array('name' => 'demo project'));
     $demoTask = $client->tasks->createInWorkspace($workspace, array(
        "name" => "demo task aa at " . date('m/d/Y h:i:s a'),
        "projects" => array($project->id)));

With the response i want to add a subtask, follower or comment, e.g.

$client->tasks->addSubtask($demoTask->id, array("name" => "subtask"));        
$client->tasks->addComment($demoTask->id, array("text" => "bla"));

Both examples don't work.

The error is "Invalid Request". I'm using the API in a Joomla-Project, with PHP 5.6

At first I thought, the problem might be the json-response of PHP 5.6 ($demoTask->id like XXXXX+E14) But the $project->id is in this format too.

thanks for your ideas!

Matt
  • 23
  • 5

1 Answers1

0

I have just tried adding a subtask as in your example and it worked fine for me.

If $demoTask->id is returning you XXXXX+E14, that may very well be the problem because it is rounding off an id incorrectly. If you get the wrong id due to a rounding error you will not be able to add the subtask since the subsequent request is not referencing your task.

Mark
  • 176
  • 4