Reputation: 4144
I am trying to pull all accounts for a QuickBooks Online account. My user has over 350 accounts to pull. Is there a way to pull them all at once? If not, is there a way to determine how many records there are to pull, then pull them in a group? Here is my code:
//pull a list of all accounts. I can only pull 100 at a time, so I need to keep enumerating until I hit 0
Account acct = new Account();
_accounts = new List<Account>();
for (int i = 1; i < 4; i++)
{
var aList = dataServices.FindAll(acct, i, 100);
if (aList.Count() == 0)
{
break;
}
_accounts.AddRange(aList);
}
I guessed that my clients have no more than 300 accounts. Is there a way I can replace the 3 or use more efficient code?
Upvotes: 1
Views: 158
Reputation: 5340
In QBO, paging is the only option to get all accounts.
In QBD, you can get the count using a rest api.PFB link. https://developer.intuit.com/docs/0025_intuit_anywhere/0050_data_services/v2/0500_quickbooks_windows/0100_calling_data_services/0015_retrieving_objects#Getting_a_Record_Count
Upvotes: 1