getItem filter field by 2 different values

209 views
Skip to first unread message

T_Gu3

unread,
Jul 11, 2012, 12:16:13 PM7/11/12
to podi...@googlegroups.com
Hi,

In the code below when the same field is used twice to filter by the items which are set to 5 are displayed only and not items that are either 2 or 5:

$item = $api->item->getItems(APP_ID, array(6108576 => 2, 6108576 => 5, 'limit' => 10, 'sort_by' => 'created_on'));

I assume that in the code the first filter (6108576 => 2) is overridden by the second (6108576 => 5). What do I do to get items which are set to either 2 or 5 and not just 5?

Regards

Thomas

Andreas Haugstrup Pedersen

unread,
Jul 11, 2012, 12:21:56 PM7/11/12
to podi...@googlegroups.com
As the documentation says, separate them with a semi-colon: https://developers.podio.com/doc/items/get-items-27803 

in your case: $item = $api->item->getItems(APP_ID, array(6108576 => "2;5", 'limit' => 10, 'sort_by' => 'created_on'));

I would suggest you move from getItems to filterItems. It uses a POST instead of a GET and as a result the syntax is much easier to handle: https://developers.podio.com/doc/items/filter-items-4496747 

- Andreas
--
Andreas Haugstrup Pedersen
Founding Developer, Podio




T_Gu3

unread,
Jul 13, 2012, 5:06:09 AM7/13/12
to podi...@googlegroups.com
Thanks for the advice

Thomas
Reply all
Reply to author
Forward
0 new messages