Show AccountID in LineItem in Invoices API
Include AccountID in LineItem in Invoices API.
Currently only AccountCode is shown in LineItems. Absence of AccountID renders cached invoices invalid when account's code is changed. Moreover, there is no guaranteed method to determine whether cached invoice became invalid.
After modification of account code certain cached invoices may have outdated account codes pointing to non-existent accounts. Or, what a horror, to different existing accounts, if previously-used account code was recycled. The latter is horrifying because if cached invoice points to non-existent account one may simply refetch the invoice, but if account code was recycled, there is no way to figure out that the cached invoice is invalid.
Worse. The If-Modified-Since mechanism will not return invoices modified due to account code change. So we are totally out of luck here: in absence of AccountIDs each account code change invalidates all cached invoices. Moreover, if I e.g. swap codes of two accounts, there is no way to know that cached invoices are invalid and point to accounts different that in Xero.
This is broken, it should be fixed by inclusion of AccountID in the invoice LineItems, which does not seem so hard.
Nicolas Emmerich commented
In addition to this, I would propose that anytime you include relationship data (account, items, tracking category, tax codes), the endpoints should include AT A MINIMUM the NATURAL ID for that data.
AccountID, ItemID, ContactID, etc. and not just rely/provide the descriptive unique name (account code, item code, etc.)