Post

2 followers Follow
0
Avatar

Getting only app items by specific date interval in .NET library

I'm building an .NET C# application, to show a week calendar overview of items in our Deliverables app.

Right now I'm getting ALL items in the app - but this will not be good solution, when we get more than 500 items, due to the request limit on the API.

Right now my "GetItems" looks like this:

var items = clioent.ItemService.GetItems(appid, 500, 0) 

500 = limit

0 = offset 

Any solution to get only items, where the Date-field is between a specific DateStart and DateEnd interval? Any sort functions (or something like that) I've missed?

The attached file shows a sneak peak of the week calendar overview - and how the items are listed.

Jesper Lund Nielsen Answered

Please sign in to leave a comment.

5 comments

0
Avatar

GetItems supports filtering items by a date-field between two dates. Take a look at the API docs, specifically the {key} parameter where it is explained how to construct a date range.

Using the .NET client, the call would be something like this (not tested):

var items = clioent.ItemService.GetItems(appid, 500, 0, "1234=2012-11-08-2012-12-24") 

where "1234" is the id of the date field you want to filter by, and "2012-11-08-2012-12-24" indicates a date between today and Christmas Eve.

Casper Fabricius 0 votes
0
Avatar

Hi Casper

Thanks for you answer.

I've now tried, but I get this error:

Podio.API.Exceptions.PodioResponseException: Invalid value '{key}': Invalid filtering key at Podio.API.Utils.PodioRestHelper.PodioResponse`1.get_Data()

I've tried following codes:

1) var items = client.ItemService.GetItems(appid, 100, 0, "19528408=2012-11-08-2012-11-12").Items;

2) var items = client.ItemService.GetItems(appid, 100, 0, "dato=2012-11-08-2012-11-12").Items;

Any ideas?

Jesper Lund Nielsen 0 votes
0
Avatar

My bad, it's actually implemented wrong in the .NET client. It's user contributed code, so not of all it has been tested. I don't know when I will have time to look at it, but the GetItems method needs to be fixed.

Casper Fabricius 0 votes
0
Avatar

Ah, okay. Until then .. then what? Just bomb the Podio API? (don't worry, we only got about 50 items by now, and they are being request every 15. minut)

Jesper Lund Nielsen 0 votes
0
Avatar

Or you can write your own API call using the "base layer" of the .NET API client as explained in the tutorial - or better yet, submit a pull request ;)

Casper Fabricius 0 votes