Jump to content

List customers with an outstanding balance


 Share

Recommended Posts

We are trying to retrieve all customers with a balance greater than zero. Currently using the URL below, which returns all customers. Is there a "filter" or "search" we can append to only return customers with a balance greater than zero?

https://api.accounting.sage.com/v3.1/contacts/?show_balance=true&contact_type_id=CUSTOMER&exclude_system=true&attributes=credit_limit

Link to comment
Share on other sites

Hi Jamie,

Thank you for your question.

Currently there is no filter available to return only the contacts with a greater than zero balance. The reason is down to the contact balance not being stored in the contact table. For us to obtain the balance the show_balance param must be passed to invoke the calculation server side. Once the balance is known the response is then returned.

This is a very resource intensive task for our servers especially if there is a lot of activity or contacts. If you're going to obtain this for all contacts our advise would be to use pagination to good effect. If you ask for the max items_per_page value of 200 there's a good chance the request will time out and return a 504.

Once you have this information, would the values be persisted into your integrations db?

If so, the most efficient way of maintaining that once obtained would be to use the updated_or_created_since=2022-11-17T00:00:00Z param on the contacts API. This would return only the contacts with activity since the date/time passed and you would then only need to obtain the balances for those contacts who have been updated/created rather than all of the CUSTOMER contacts.

Thanks

Mark

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...