Skip to content

Methods: Labels

Fabian Beiner edited this page Jan 2, 2020 · 6 revisions

“Labels” methods and examples

Labels are a Premium feature by Todoist.

Get all labels

Method:

getAllLabels()

Example:

var_dump($Todoist->getAllLabels());

array (size=2)
  0 => 
    array (size=3)
      'id' => int 2148896065
      'name' => string 'Tomorrow' (length=8)
      'order' => int 1
  1 => 
    array (size=3)
      'id' => int 2148896066
      'name' => string 'Someday' (length=7)
      'order' => int 2

Create a new label

Method:

createLabel(string $labelName, [array $optionalParameters])

Example:

var_dump($Todoist->createLabel('Another Label'));

array (size=3)
  'id' => int 2153820097
  'name' => string 'Another_Label' (length=13)
  'order' => int 26

Get a label

Method:

getLabel(int $labelId)

Example:

var_dump($Todoist->getLabel(2153820097));

array (size=3)
  'id' => int 2153820097
  'name' => string 'Another_Label' (length=13)
  'order' => int 26

Update a label

Method:

updateLabel(int $labelId, string $newLabelName)

Example:

var_dump($Todoist->updateLabel(2153820097, 'New Name Label'));

boolean

Delete a label

Method:

deleteLabel(int $labelId)

Example:

var_dump($Todoist->deleteLabel(2153820097));

boolean