0

I have used var invoicesinxero = await _accountingApi.GetInvoicesAsync(accessToken, tenantId, statuses: new List { "DRAFT" }, where: "Type == \"ACCREC\"");

There are 700+ Draft invoices in my account but the above only fetched 100 invoices Below are the versions of the references used : Xero.NetStandard.OAuth2 v0.1.0 Xer.NetStandard.OAuth2Client v0.0.2

Am I supposed to used another method or is there another way to fetch invoices

  • As far as I know, by default it will page results and you will only get 100 results. You need to manually retrieve each page by specifying the page number in your request. I don't have OAuth2 working yet so I can't say exactly how it's done. – droopsnoot Apr 13 '20 at 17:51

1 Answers1

0

you will need to make multiple calls to get all 700 invoices, via the page parameter in the GetInvoicesAsync. We are working to make the documentation better for all SDK's - but if you look at that function code you can see the 20th optional parameter is int? page = null,

GetInvoicesAsync (
  string accessToken,
  string xeroTenantId,
  DateTime? ifModifiedSince = null,
  string where = null,
  string order = null,
  List<Guid> iDs = null,
  List<string> invoiceNumbers = null,
  List<Guid> contactIDs = null,
  List<string> statuses = null,
  int? page = null,
  bool? includeArchived = null,
  bool? createdByMyApp = null,
  int? unitdp = null
);

Since these files are auto-generated then can get quite large, and while it is not ideal to parse through you can find the function def here:

https://raw.githubusercontent.com/XeroAPI/Xero-NetStandard/master/Xero.NetStandard.OAuth2/Api/AccountingApi.cs

SerKnight
  • 2,502
  • 1
  • 16
  • 18