getTaskStories() public method

As usual with queries, stories are returned in compact form. However, the compact form for stories contains more information by default than just the ID. There is presently no way to get a filtered set of stories.
public getTaskStories ( string $taskId, array $opts = [] ) : string
$taskId string
$opts array Array of options to pass (@see https://asana.com/developers/documentation/getting-started/input-output-options)
return string JSON or null
<?php

require_once '../asana.php';
// See class comments and Asana API for full info
$asana = new Asana(array('apiKey' => 'XXXXXXX.XXXXXXXXXXXXXXXXXXXXXXXX'));
// Your API Key, you can get it in Asana
$taskId = 10924433056204.0;
$resultJson = $asana->getTask($taskId);
// As Asana API documentation says, when response is successful, we receive a 200 in response so...
if ($asana->responseCode != '200' || is_null($resultJson)) {
    echo 'Error while trying to connect to Asana, response code: ' . $asana->responseCode;
    return;
}
$task = json_decode($resultJson);
echo "Task details:" . PHP_EOL;
var_dump($task);
$resultJson = $asana->getTaskStories($taskId);
// As Asana API documentation says, when response is successful, we receive a 200 in response so...
if ($asana->responseCode != '200' || is_null($resultJson)) {
    echo 'Error while trying to connect to Asana, response code: ' . $asana->responseCode;
    return;
}
$stories = json_decode($resultJson);
echo "Task stories(comments):" . PHP_EOL;
var_dump($stories);
<?php

require_once '../asana.php';
// See class comments and Asana API for full info
$asana = new Asana(array('apiKey' => 'XXXXXXX.XXXXXXXXXXXXXXXXXXXXXXXX'));
// Your API Key, you can get it in Asana
$taskId = 10924433056204.0;
$asana->getTask($taskId);
// As Asana API documentation says, when response is successful, we receive a 200 in response so...
if ($asana->hasError()) {
    echo 'Error while trying to connect to Asana, response code: ' . $asana->responseCode;
    return;
}
echo "Task details:" . PHP_EOL;
var_dump($asana->getData());
$asana->getTaskStories($taskId);
// As Asana API documentation says, when response is successful, we receive a 200 in response so...
if ($asana->hasError()) {
    echo 'Error while trying to connect to Asana, response code: ' . $asana->responseCode;
    return;
}
echo "Task stories(comments):" . PHP_EOL;
var_dump($asana->getData());
Example #3
0
                <th>Date /Time Posted</th>
                <th>Task Name</th>
                <th>Description</th>
                <th>Comments</th>
            </tr>
            </thead>
            <tbody>
            <?php 
foreach ($tasksJson->data as $task) {
    /*print_r($task);
      die();*/
    $taskDetail = json_decode($asana->getTask($task->id));
    if ($asana->responseCode != '200' || is_null($taskDetail)) {
        continue;
    }
    $taskStories = json_decode($asana->getTaskStories($task->id));
    ?>
                <tr>
                    <td><?php 
    echo date("M, d Y", strtotime($taskDetail->data->created_at));
    ?>
</td>
                    <td><?php 
    echo $taskDetail->data->name;
    ?>
</td>
                    <td><?php 
    echo $taskDetail->data->notes;
    ?>
</td>
                    <td>
    exit;
}
$projects = $asana->getData();
foreach ($projects as $project) {
    echo '<strong>[ ' . $project->name . ' (id ' . $project->id . ')' . ' ]</strong><br>' . PHP_EOL;
    //if ($project->id != 42) { // Quickly filter on a project
    //  continue;
    //}
    // Get all tasks in the current project
    $asana->getProjectTasks($project->id);
    if ($asana->hasError()) {
        echo 'Error while trying to connect to Asana, response code: ' . $asana->responseCode;
        continue;
    }
    foreach ($asana->getData() as $task) {
        echo '+ ' . $task->name . ' (id ' . $task->id . ')' . ' ]<br>' . PHP_EOL;
        $asana->getTask($task->id);
        if (!$asana->hasError()) {
            $task->details = $asana->getData();
            //var_dump($task->details);
        }
        $asana->getTaskStories($task->id);
        if (!$asana->hasError()) {
            $task->stories = $asana->getData();
            //var_dump($task->stories);
        }
    }
}
//var_dump($projects);
echo "All as JSON:\n";
echo json_encode($projects);