3
from pypodio2 import api

# Authenticate as App
podio_client = api.OAuthAppClient(
    client_id=PODIO_CLIENT_ID,
    client_secret=PODIO_CLIENT_SECRET,
    app_id=PODIO_APP_ID,
    app_token=PODIO_APP_TOKEN,    
)

# Set limit to 100
items = podio_client.Item.filter(app_id=PODIO_APP_ID, attributes={}, limit=100)

My app has a total of 251 items and I expect that the API would return 100 items but it only returns 20... How to fix this?

print(items['total'])

251

print(items['filtered'])

251

print(len(items['items'])

20

Update

I tried it with the requests library but still no success...

import requests
payload = {
  "filters":{},
  "limit": 30
}
resp = requests.post(url="https://api.podio.com/item/app/randomappid/filter/", 
                    headers={'authorization': 'OAuth2 randomn0mber'},
                    data=payload)

len(resp.json()['items'])

20

API call docs: https://developers.podio.com/doc/items/filter-items-4496747

Stanko
  • 4,275
  • 3
  • 23
  • 51
  • Can you post a snippet of your items object ? from a first glance, it only looks like your object items has a key 'items' that holds 20 elements. – lalam Apr 14 '19 at 15:18
  • The object `items` has three keys: total, filtered and items. `Total` indicates how much items the application has, `filtered` says how much items are left after applying the filter and `items` has al the items. I want to get 251 items by applying no filter, I added the 100 limit to show that it is broken because I only get 20 items. – Stanko Apr 14 '19 at 15:30
  • Shouldn't the items['filtered'] return 100 items as well? – nimishxotwod Apr 14 '19 at 15:49
  • @nimish666 It only contains an integer. – Stanko Apr 14 '19 at 16:36

2 Answers2

5

limit must pass thru the attributes parameter.

# Set limit to 100
items = podio_client.Item.filter(app_id=PODIO_APP_ID, attributes={"limit": 100})
Mûhámmàd Yäsår K
  • 1,492
  • 11
  • 24
0

Not ideal but using the deprecated api call I get the desired results... Would still like to know how to do it using the filter api call.

params = {"limit": 300}
resp = requests.get(url="https://api.podio.com/item/app/randomappid/", 
                    headers={'authorization': 'OAuth2 randomn0mber'},
                    params=params)

len(resp.json()['items'])

251

Stanko
  • 4,275
  • 3
  • 23
  • 51