NoobCoder
NoobCoder

Reputation: 127

Can't get all Items from Podio's API (App). C#

I am using Podio's API in my .NET program and in the C# code I am successfully grabbing the items from my App in Podio. The issue is that there's a limit to how many items I can grab from my Apps collection, I believe my set limit is 30 ( and I have more then 30 items ).

I want to be able to grab all items in an App and not a default amount of 30 items. I'll show some code:

Below, I have hard coded values into the new Podio object and I want to be authenticate it so I can use it, (Works fine here).

var podio = new Podio("Secret-Name", "Secret-Code");
podio.AuthenticateWithApp("Secret-Number", "Secret-Code");

Below, this is where I am grabbing the items from an App and "filteredItems.Total" does return the maximum amount of items in the collection.

var filteredItems = podio.ItemService.FilterItems("Secret-Number");

The code below does not return the maximum amount of items but only a default amount.

foreach (var eachItem in filteredItems.Items)
{
                System.Diagnostics.Debug.WriteLine(eachItem.Title + " - " eachItem.ItemId +" ");
}

The issue is either, podio's methods cannot read the maximum amount of items in a collection ( because of some default maximum amount) OR the foreach loop has a maximum limit.

Thank you for the help.

Upvotes: 0

Views: 186

Answers (3)

NoobCoder
NoobCoder

Reputation: 127

Found out how to solve my issue

Before I had:

   

 var filteredItems = podio.ItemService.FilterItems("Secret-Number");

But we can manually set how many items we can see (limit is 500)

var filteredItems = podio.ItemService.FilterItems("Secret-Number", 500);

Upvotes: 0

Hasta Tamang
Hasta Tamang

Reputation: 2263

Yes you are correct that endpoint is rate limited and defaults to 30 items

Check the documentation here: https://developers.podio.com/doc/items/filter-items-4496747

Source code: https://github.com/podio/podio-dotnet/blob/master/Source/Podio%20.NET/Services/ItemService.cs

The code below increases this limit to 100

var filterOptions = new FilterOptions()
{
        Limit = 100
};
var filteredItems = podio.ItemService.FilterItems(appId, filterOptions, false);

Upvotes: 0

Lesiak
Lesiak

Reputation: 26074

Just specify the limit using FilterOptions

See definition of FilterItems method at https://github.com/podio/podio-dotnet/blob/master/Source/Podio%20.NET/Services/ItemService.cs

public async Task<PodioCollection<Item>> FilterItems(int appId, FilterOptions filterOptions, bool includeFiles = false)
{
    filterOptions.Limit = filterOptions.Limit == 0 ? 30 : filterOptions.Limit;
    // ...
}

Upvotes: 2

Related Questions