Skip to content

Methods: Projects

Fabian Beiner edited this page Nov 12, 2017 · 5 revisions

“Projects” methods and examples

Get all projects

$allProjects = $Todoist->getAllProjects();

Example result:

print_r($allProjects);

(
    [0] => stdClass Object
        (
            [id] => 123456789
            [name] => Inbox
            [order] => 0
            [indent] => 1
            [comment_count] => 0
        )

    [1] => stdClass Object
        (
            [id] => 987654321
            [name] => Project
            [order] => 1
            [indent] => 1
            [comment_count] => 0
        )

    …
)

Create a new project

$createProject = $Todoist->createProject('Example Project');

Example result:

print_r($createProject);

stdClass Object
(
    [id] => 123454321
    [name] => Example Project
    [order] => 2
    [indent] => 1
    [comment_count] => 0
)

Get a project

$project = $Todoist->getProject('123454321');

Example result:

print_r($project);

stdClass Object
(
    [id] => 123454321
    [name] => Example Project
    [order] => 2
    [indent] => 1
    [comment_count] => 0
)

Update (actually rename…) a project

$Todoist->updateProject('123454321', 'New Project Name');

Example result:

print_r($Todoist->updateProject('123454321', 'New Project Name'));

1

Delete a project

$Todoist->deleteProject('123454321');

Example result:

print_r($Todoist->deleteProject('123454321'));

1
Clone this wiki locally