Asana::moveTaskWithinProject PHP Method

moveTaskWithinProject() public method

Moves a task within a project relative to another task. This should let you take a task and move it below or above another task as long as they are within the same project.
public moveTaskWithinProject ( string $projectId, string $taskToMove, string $taskReference, boolean $insertAfter = true ) : string
$projectId string the project $taskReference is in and optionally $taskToMove is already in ($taskToMove will be added to the project if it's not already there)
$taskToMove string the task that will be moved (and possibly added to $projectId
$taskReference string the task that indicates a position for $taskToMove
$insertAfter boolean true to insert after $taskReference, false to insert before
return string JSON or null
    public function moveTaskWithinProject($projectId, $taskToMove, $taskReference, $insertAfter = true)
    {
        $data = array('data' => array('project' => $projectId));
        if ($insertAfter) {
            $data['data']['insert_after'] = $taskReference;
        } else {
            $data['data']['insert_before'] = $taskReference;
        }
        $data = json_encode($data);
        return $this->askAsana($this->taskUrl . '/' . $taskToMove . '/addProject', $data, ASANA_METHOD_POST);
    }