I am beginning to learn the PHP Client Library and started with "Hello World" example on http://podio.github.io/podio-php/. I basic script is working and does return a result (I have the client id/secret and the app id/token set up).
When I echo the results of count(PodioItem::filter($app_id));
only 20 items are returned however there are in fact 110 items in the app.
My question is what am I doing wrong? What have I left out?
This seems like a very basic example. I did some searching on Google and StackOverflow and I did not find anyone having this problem.
My script is authenticated and returns results but not ALL the results. I can get as many as 50 using the array('limit'=>xx) option. My app has 110 items.
ALSO, if I do: print_r(PodioItem::filter($appid));
the output DOES report '[total] => 110' But the array dump is only 20 items.
My php memory limit is set at 512MB. And print_r(error_get_last());
is empty (error reporting is turned on).
PodioItem::filter()
will only return 20 items by default. You can see the full range of options at https://developers.podio.com/doc/items/filter-items-4496747
As you can see you need to pass a limit
parameter to get more items. To get 100 items:
$items = PodioItem::filter($app_id, array('limit' => 100));
You can get up to 500 items this way. If you need more items you have to use multiple requests and the offset
parameter to skip over items you already have.
The total
property will always give you the total amount of items in the app, regardless of how many items you currently have in your local collection. In a similar manner filtered
will always give you the total items in the current filtered view regardless of how many items you have in your local collection. This information is important if you are building e.g. pagination.
(The code line was missing a closing parenthesis. [fixed])