Xero-NetStandard icon indicating copy to clipboard operation
Xero-NetStandard copied to clipboard

HighVolumeException filtering Contacts

Open TheJackGower opened this issue 9 months ago • 3 comments

SDK you're using (please complete the following information):

  • Version 11.1.1

Describe the bug When retrieving a filtered list of contacts using the GetContactsAsync method, the API throws a HighVolumeException (ErrorNumber: 51) even when applying a valid where clause to limit the result set. The clause used is:

where: "IsSupplier==true OR (IsSupplier==false AND IsCustomer==false)"

The organisation has over 115,000 contacts. Despite using proper filtering and paging syntax as per Xero’s documentation, the API still fails due to inefficient filtering, making it impossible to retrieve all relevant contacts.

To Reproduce Steps to reproduce the behavior: 1 - Authenticate with an organisation with >100k contacts. 2 - Call accountingApi.GetContactsAsync with the above where clause. 3 - Do not include If-Modified-Since (i.e., attempt a full filter-based pull). 4 - Observe the HighVolumeException returned by the API.

Expected behavior The API should successfully return a filtered list of contacts matching the given where clause, especially since the filter limits results to a subset of the full contact list.

Screenshots Image

Additional context

  • We believe the customer to only have a couple thousand contacts that match the filter predicate.
  • This creates a limitation in Xero’s API where even valid filters are considered "inefficient" at scale.

TheJackGower avatar Apr 29 '25 07:04 TheJackGower

PETOSS-742

github-actions[bot] avatar Apr 29 '25 07:04 github-actions[bot]

Thanks for raising an issue, a ticket has been created to track your request

github-actions[bot] avatar Apr 29 '25 07:04 github-actions[bot]

We've tried to avoid applying any filtering on the query and instead handle in memory.

This means looping until we reach the final page (over 1000), however we are then rate limited:

Xero.NetStandard.OAuth2.Client.ApiException: Xero API minute rate limit error calling GetContacts at Xero.NetStandard.OAuth2.Api.AccountingApi.GetContactsAsyncWithHttpInfo(String accessToken, String xeroTenantId, Nullable`1 ifModifiedSince, String where, String order, List`1 iDs, Nullable`1 page, Nullable`1 includeArchived, Nullable`1 summaryOnly, String searchTerm, Nullable`1 pageSize, CancellationToken cancellationToken) at Xero.NetStandard.OAuth2.Api.AccountingApi.GetContactsAsync(String accessToken, String xeroTenantId, Nullable`1 ifModifiedSince, String where, String order, List`1 iDs, Nullable`1 page, Nullable`1 includeArchived, Nullable`1 summaryOnly, String searchTerm, Nullable`1 pageSize, CancellationToken cancellationToken)

TheJackGower avatar May 01 '25 06:05 TheJackGower