0

Xero documentation says: "Each API response you receive will include the X-DayLimit-Remaining, X-MinLimit-Remaining and X-AppMinLimit-Remaining headers telling you the number of remaining against each limit."

How do I access these limits? When I make a call for a balance sheet for example:

Xero.NetStandard.OAuth2.Model.Accounting.ReportWithRows pal = await apiInstance.GetReportBalanceSheetAsync(accessToken, xeroTenantId, startDate, 1, timeFrame, null, null, true, false).ConfigureAwait(false);

The returned json document does not have any limit information. I Googled that some headers need to be included. Is there a c# code example on how to get those headers?

Thanks.

bn_ln
  • 1,648
  • 1
  • 6
  • 13
  • I can't say how you'd access it via the API, but in the response from a raw http call in VB, the headers are in response.headers. I had a quick look through the API but I can't follow it easily enough. – droopsnoot Nov 09 '22 at 08:30
  • I need an example of code in c#. Perhaps there are some Xero developers out there. – Roust_m Nov 09 '22 at 11:34
  • To get the headers for say the account endpoint you could just use `curl -I -X 'GET' 'https://api.xero.com/api.xro/2.0/Accounts' -H 'accept: application/json' -H 'Xero-tenant-id: ``' -H 'Authorization: Bearer ``'` (you need to have an valid access token obviously too). – bn_ln Dec 20 '22 at 06:34

0 Answers0