Asana/php-asana Invalid Request

i want to use Asana-Api by using PHP-Asana (GitHub - Asana/php-asana: Official PHP client library for the Asana API v1).

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!

I am a bit surprised you are passing an array, I would expect addSubtask to take an object instead with key-value pairs, but maybe that’s how PHP works.

Anyway, the answer invalid request always has details about what’s the issue. Can you share it here?