0

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

kiuru
  • 1
  • 1
  • Where any of the 100 journals returned from November? – Sara Fuerst Dec 20 '18 at 16:07
  • If I made request with `offset=700` parameter, I got a part of November 2018. Without offset I didn't get anything, because in default Xero returns data which JournalID is => 100. – kiuru Dec 21 '18 at 07:42

0 Answers0