Xero API: How to fetch journals by defined time period

273 views Asked by At

I am going to fetch our customers journals data from Xero API to our application. Now I am wondering how I can do that.

Our customer is started their business at 2017-01-01, and they have more than 100 journals in one year. It means that I can't fetch whole year at the same time, because Xero limits one response to 100 journals.

My question is, how I can fetch journals by defined time period, e.g. in November 2018?

The following request returns first 100 journals to me:

GET /api.xro/2.0/Journals?where=JournalDate>=DateTime.Parse("2017-01-01")&&JournalDate<=DateTime.Parse("2017-12-31")

But if I run the following request (November 2018) it will return 0 journals:

GET /api.xro/2.0/Journals?where=JournalDate>=DateTime.Parse("2018-11-01")&&JournalDate<=DateTime.Parse("2018-11-30")

I have found that with offset 700 I got something, but there must be better solution, than loop every one hundred sets offsets from zero to infinity.. Because JournalID 5000 can belongs to 2017-01-01.

EDIT: There is how I solved this issue: https://github.com/kiuru/xero-api-client

0

There are 0 answers