The following PHP method isn’t workin in my class for me even though the $workspace_id and $project_id are valid (and were obtained using the SDK connected to my Asana account).
public function handle() {
$task = $this->asana->tasks->createTask(
[
'workspace' => $workspace_id,
'projects' => [$project_id],
'name' => $content_story->title,
'notes' => $content_story->description
],
['opt_pretty' => 'true']
);
}
It returns the following exception:
Asana\Errors\InvalidRequestError : Invalid Request
at /home/…/vendor/asana/asana/src/Asana/Errors/AsanaError.php:28
24| switch ($response->code) {
25| case ForbiddenError::STATUS:
26| throw new ForbiddenError($response);
27| case InvalidRequestError::STATUS:
28| throw new InvalidRequestError($response);
29| case InvalidTokenError::STATUS:
30| throw new InvalidTokenError($response);
31| case NoAuthorizationError::STATUS:
32| throw new NoAuthorizationError($response);
Exception trace:
1 Asana\Errors\AsanaError::handleErrorResponse(Object(Httpful\Response))
/home/…/vendor/asana/asana/src/Asana/Client.php:98
2 Asana\Client::request(“POST”, “/tasks”)
/home/…/vendor/asana/asana/src/Asana/Client.php:247