Aged Receivables/Payables by all contacts in API
Be able to get aged Receivables and Payables for all contacts via the API and not have to call them one at a time!!!!
Surely this would be a massive help to your own API given I'm sure multiple people are just smashing the API by making call after call to get all the contacts out!!!
Was tasked with getting this report out which exists in the back office. I assumed it would be an easy API call. But no. This makes this exercise needlessly wasteful. As a new dev coming to this API it is soul crushing to see an issue like this open for 5 years with not a single update from the API team, it does not bode well.
For those following on behind I was lucky that with some thinking outside the box I managed to find a way around it using the Invoice API to get all outstanding invoices that are over due. Hope this gives you some pointers.
First up I found the API Explorer really handy, I'll include the links to that here but you will have to sign in to see them.
Get all contacts who are active and customers (I don't care about suppliers):
I need to keep hold of this and use it as a look up in the next step when we get all invoices. Reason being that there is no way to filter the invoices to just Customers, they could be from suppliers too so in my code I have to manually filter out all invoices that aren't in this list of Contacts.
From there I managed to get a list of all outstanding invoices (all those with a status of "AUTHORISED") that have a due date over a week old (I generate out the current date in my api param:
So that is 2 requests per account instead of having to harvest everything per contact. Might not be exactly what you want but from that I was able to get what I needed. Thanks Xero for the loop jumping and the timely updates.