Search code examples
podio

Filter Podio Items by Item ID


I'm having a bit of an issue getting a collection of Podio items from an app by item ids.

According to this post, Andreas said that "... you can now filter by item_id (and app_item_id). Just use item_id or app_item_id as the filter key and give it an array of item ids ...".

So I'm trying to get a bunch of items in one shot to reduce API calls with:

$attributes = ["filter" => [
    "item_id" => [12345,23456]
]];
$items = PodioItem::filter( $app_id, $attributes );

But I'm always getting all items back from the app, not just the 2 items listed in the filter.

Anyone come across this anomaly before? Workarounds?


Solution

  • You are passing the $attributes array in the wrong format. You have to pass it in filters array like,

    $attributes = ["filters" => [
        "item_id" => [12345,23456]
    ]];
    $items = PodioItem::filter( $app_id, $attributes );
    

    You will get back only the mentioned items [12345,23456].