Andrew Fields
Andrew Fields

Reputation: 51

How to get all the tasks for a specific appitem

I have spent the last 4 hrs trying to figure out how to get the list of Tasks that reference a specific AppItem.

The following do NOT work:

// Doesn't work
// $tasks = PodioTask::get_all(array(
// 'reference' => 'rmticket:' . $rmt->item_id,
// ));

// $tasks = PodioTask::get_all(array(
// 'reference' => array('type' => 'rmticket', 'id' => $rmt->item_id),
// ));

// $tasks = PodioTask::get_all(array(
// 'item' => $rmt->item_id,
// ));

// $tasks = PodioTask::get_all(array(
// 'ref_id' => $rmt->item_id,
// ));

Documentation here: https://developers.podio.com/doc/tasks/get-tasks-77949

says that the parameter for this is:

reference

The list of references on the form "type:id" separated by semi-colon.

That is the first thing I tried, and I get the following error:

Uncaught PodioBadRequestError: "Invalid value "rmticket" (string): must be one of {'comment', 'rating', 'invoice', 'campaign', 'app_revision', 'app', 'share', 'system', 'hook', 'tag', 'voucher', 'file', 'flow_effect', 'vote', 'partner', 'message', 'conversation', 'share_install', 'form', 'space_member_request', 'space', 'notification', 'auth_client', 'question', 'integration', 'payment', 'subscription', 'live', 'label', 'answer', 'icon', 'location', 'status', 'org_member', 'widget', 'extension_installation', 'file_service', 'app_field', 'alert', 'profile', 'user', 'task_action', 'org', 'condition_set', 'embed', 'condition', 'space_member', 'identity', 'item_participation', 'task', 'extension', 'linked_account', 'grant', 'flow', 'batch', 'contract', 'project', 'item', 'connection', 'flow_condition', 'question_answer', 'action', 'item_revision', 'voting', 'promotion', 'bulletin', 'view'

-- Andrew.

UPDATE: I also have tried the following:

//    $tasks = PodioTask::get_all(array(
//      'grouping' => 'rmticket:' . $rmt->item_id,
//    ));
    // Fatal error: Uncaught PodioBadRequestError: "Invalid value "rmticket:720406510" (string): Must be one of ['due_date', 'completed_on', 'reference', 'space', 'app', 'responsible', 'created_by', 'label', 'org' in /home/avcorp/vhosts/pubvps/vendor/podio/podio-php/lib/Podio.php on line 289

//    $tasks = PodioTask::get_all(array(
//      'grouping' => 'reference',
//      'item_id' => $rmt->item_id,
//    ));
    // Fatal error: Uncaught PodioBadRequestError: "Invalid filter item_id" Request URL: http://api.podio.com/task/?grouping=reference&item_id=720406510 Stack Trace: #0 /home/avcorp/vhosts/pubvps/vendor/podio/podio-php/lib/Podio.php(349): Podio::request('GET', '/task/', Array, Array) #1 /home/avcorp/vhosts/pubvps/vendor/podio/podio-php/models/PodioTask.php(100): Podio::get('/task/', Array) #2 /home/avcorp/vhosts/pubvps/podio_rmticket/rmticket_util.php(217): PodioTask::get_all(Array) #3 /home/avcorp/vhosts/pubvps/podio_rmticket/rmticket_util.php(152): rmtCreateTask(Object(AvcPodioItem), 'Carpet Cleaning', 10, 3) #4 /home/avcorp/vhosts/pubvps/podio_rmticket/poll/rmticket_poll.php(54): test_task_creation() #5 {main} thrown in /home/avcorp/vhosts/pubvps/vendor/podio/podio-php/lib/Podio.php on line 289

//  $tasks = PodioTask::get_all(array(
//      'grouping' => 'reference',
//      'item' => $rmt->item_id,
//  ));
  // Fatal error: Uncaught PodioBadRequestError: "Invalid filter item" Request URL: http://api.podio.com/task/?grouping=reference&item=720406510 Stack Trace: #0 /home/avcorp/vhosts/pubvps/vendor/podio/podio-php/lib/Podio.php(349): Podio::request('GET', '/task/', Array, Array) #1 /home/avcorp/vhosts/pubvps/vendor/podio/podio-php/models/PodioTask.php(100): Podio::get('/task/', Array) #2 /home/avcorp/vhosts/pubvps/podio_rmticket/rmticket_util.php(222): PodioTask::get_all(Array) #3 /home/avcorp/vhosts/pubvps/podio_rmticket/rmticket_util.php(152): rmtCreateTask(Object(AvcPodioItem), 'Carpet Cleaning', 10, 3) #4 /home/avcorp/vhosts/pubvps/podio_rmticket/poll/rmticket_poll.php(54): test_task_creation() #5 {main} thrown in /home/avcorp/vhosts/pubvps/vendor/podio/podio-php/lib/Podio.php on line 289

//  $tasks = PodioTask::get_all(array(
//      'grouping' => 'reference',      
//  ));
  //  Fatal error: Uncaught PodioBadRequestError: "Query not restrictive enough, must filter on either org, space, app, responsible, reference, created_by or completed_by" Request URL: http://api.podio.com/task/?grouping=reference Stack Trace: #0 /home/avcorp/vhosts/pubvps/vendor/podio/podio-php/lib/Podio.php(349): Podio::request('GET', '/task/', Array, Array) #1 /home/avcorp/vhosts/pubvps/vendor/podio/podio-php/models/PodioTask.php(100): Podio::get('/task/', Array) #2 /home/avcorp/vhosts/pubvps/podio_rmticket/rmticket_util.php(227): PodioTask::get_all(Array) #3 /home/avcorp/vhosts/pubvps/podio_rmticket/rmticket_util.php(152): rmtCreateTask(Object(AvcPodioItem), 'Carpet Cleaning', 10, 3) #4 /home/avcorp/vhosts/pubvps/podio_rmticket/poll/rmticket_poll.php(54): test_task_creation() #5 {main} thrown in /home/avcorp/vhosts/pubvps/vendor/podio/podio-php/lib/Podio.php on line 289

//  $tasks = PodioTask::get_all(array(
//      'grouping' => 'reference:' . $rmt->item_id,      
//  ));
  // Fatal error: Uncaught PodioBadRequestError: "Invalid value "reference:720406510" (string): Must be one of ['due_date', 'completed_on', 'reference', 'space', 'app', 'responsible', 'created_by', 'label', 'org' in /home/avcorp/vhosts/pubvps/vendor/podio/podio-php/lib/Podio.php on line 289

//  $tasks = PodioTask::get_all(array(
//      'item' => array('item_id' => $rmt->item_id),
//  ));
  // Fatal error: Uncaught PodioBadRequestError: "Invalid filter item" Request URL: http://api.podio.com/task/?item= Stack Trace: #0 /home/avcorp/vhosts/pubvps/vendor/podio/podio-php/lib/Podio.php(349): Podio::request('GET', '/task/', Array, Array) #1 /home/avcorp/vhosts/pubvps/vendor/podio/podio-php/models/PodioTask.php(100): Podio::get('/task/', Array) #2 /home/avcorp/vhosts/pubvps/podio_rmticket/rmticket_util.php(238): PodioTask::get_all(Array) #3 /home/avcorp/vhosts/pubvps/podio_rmticket/rmticket_util.php(152): rmtCreateTask(Object(AvcPodioItem), 'Carpet Cleaning', 10, 3) #4 /home/avcorp/vhosts/pubvps/podio_rmticket/poll/rmticket_poll.php(54): test_task_creation() #5 {main} thrown in /home/avcorp/vhosts/pubvps/vendor/podio/podio-php/lib/Podio.php on line 289

//  $tasks = PodioTask::get_all(array(
//      'grouping' => 'reference',    
//      'ref_id' => $rmt->item_id,
//  ));
  // Fatal error: Uncaught PodioBadRequestError: "Invalid filter ref_id" Request URL: http://api.podio.com/task/?grouping=reference&ref_id=720406510 Stack Trace: #0 /home/avcorp/vhosts/pubvps/vendor/podio/podio-php/lib/Podio.php(349): Podio::request('GET', '/task/', Array, Array) #1 /home/avcorp/vhosts/pubvps/vendor/podio/podio-php/models/PodioTask.php(100): Podio::get('/task/', Array) #2 /home/avcorp/vhosts/pubvps/podio_rmticket/rmticket_util.php(243): PodioTask::get_all(Array) #3 /home/avcorp/vhosts/pubvps/podio_rmticket/rmticket_util.php(152): rmtCreateTask(Object(AvcPodioItem), 'Carpet Cleaning', 10, 3) #4 /home/avcorp/vhosts/pubvps/podio_rmticket/poll/rmticket_poll.php(54): test_task_creation() #5 {main} thrown in /home/avcorp/vhosts/pubvps/vendor/podio/podio-php/lib/Podio.php on line 289

//  $tasks = PodioTask::get_all(array(
//      'grouping' => 'reference',    
//      'reference' => 'rmticket:' . $rmt->item_id,
//  ));
  // Fatal error: Uncaught PodioBadRequestError: "Invalid value "rmticket" (string): must be one of {'comment', 'rating', 'invoice', 'campaign', 'app_revision', 'app', 'share', 'system', 'hook', 'tag', 'voucher', 'file', 'flow_effect', 'vote', 'partner', 'message', 'conversation', 'share_install', 'form', 'space_member_request', 'space', 'notification', 'auth_client', 'question', 'integration', 'payment', 'subscription', 'live', 'label', 'answer', 'icon', 'location', 'status', 'org_member', 'widget', 'extension_installation', 'file_service', 'app_field', 'alert', 'profile', 'user', 'task_action', 'org', 'condition_set', 'embed', 'condition', 'space_member', 'identity', 'item_participation', 'task', 'extension', 'linked_account', 'grant', 'flow', 'batch', 'contract', 'project', 'item', 'connection', 'flow_condition', 'question_answer', 'action', 'item_revision', 'voting', 'promotion', 'bulletin', 'view' in /home/avcorp/vhosts/pubvps/vendor/podio/podio-php/lib/Podio.php on line 289

//  $tasks = PodioTask::get_all(array(
//      'grouping' => 'reference',    
//      'reference' => $rmt->item_id,
//  ));
  // Fatal error: Uncaught PodioBadRequestError: "Expected references on the form type:id" Request URL: http://api.podio.com/task/?grouping=reference&reference=720406510 Stack Trace: #0 /home/avcorp/vhosts/pubvps/vendor/podio/podio-php/lib/Podio.php(349): Podio::request('GET', '/task/', Array, Array) #1 /home/avcorp/vhosts/pubvps/vendor/podio/podio-php/models/PodioTask.php(100): Podio::get('/task/', Array) #2 /home/avcorp/vhosts/pubvps/podio_rmticket/rmticket_util.php(255): PodioTask::get_all(Array) #3 /home/avcorp/vhosts/pubvps/podio_rmticket/rmticket_util.php(152): rmtCreateTask(Object(AvcPodioItem), 'Carpet Cleaning', 10, 3) #4 /home/avcorp/vhosts/pubvps/podio_rmticket/poll/rmticket_poll.php(54): test_task_creation() #5 {main} thrown in /home/avcorp/vhosts/pubvps/vendor/podio/podio-php/lib/Podio.php on line 289

The last one is the closest, but as you can see, while I CANNOT send a 'reference' => type:id it seems to require it. Is this a bug in Podio's API?

-- Andrew.

Upvotes: 3

Views: 179

Answers (1)

Andrew Fields
Andrew Fields

Reputation: 51

Finally figured it out (no thanks to the Podio documentation). This works:

$tasks = PodioTask::get_all(array(
    'grouping' => 'reference',    
    'reference' => 'item:' . $rmt->item_id,
));

Apparently, the "type" they are looking for is NOT the type of the Item, but one of a list of possible "reference" types. Course, that COULD have been documented, but as with much of Podio's API docs, they have LOTS of docs, but much of it is just top-level "basic" docs with little detail and lots of "hand-waving"...frustrating...

Upvotes: 2

Related Questions