0

I am targeting the https://api.xero.com/api.xro/2.0/Invoices endpoint, specifying either no invoice or a specific invoice. In both cases I am not receiving the ItemCode, DiscountRate and DiscountAmount components of the LineItems array.

Is there a query string item that will force the missing components to appear? These "Elements for LineItems" components are supposed to be there, assuming I've read the documentation correctly.

bugmagnet
  • 7,631
  • 8
  • 69
  • 131
  • That's very strange, to not get ItemCode at least. As it says on that page, DiscountRate and DiscountAmount are only on ACCREC invoices, and you only get LineItem details if you specify an individual invoice. Are these all ACCREC invoices? Although I notice that their example is an ACCREC invoice which also doesn't include those two fields. – droopsnoot Sep 29 '22 at 07:17
  • Everything is ACCREC. The individual invoice is also an ACCREC invoice. – bugmagnet Sep 29 '22 at 08:23
  • I just tried retrieving an invoice from my test code, and I still don't know why you're not seeing these fields. I tried the same link, using the Invoice ID to specify the invoice, and my line item includes ItemCode, DiscountRate and DiscountAmount. If you try in the API explorer for the same Invoice ID, does it give any more information? Failing that, contact the API support team api@support.xero.com and see if they can help. – droopsnoot Sep 29 '22 at 10:45
  • What scopes are you using for that? I'm using "accounting.transactions.read accounting.budgets.read accounting.reports.read accounting.settings.read accounting.journals.read accounting.contacts.read accounting.attachments.read". It may be that I need another one. – bugmagnet Sep 29 '22 at 13:09
  • I'm in the API Explorer now and am NOT seeing ItemCode in the LineItems. Curiouser and curiouser. – bugmagnet Sep 29 '22 at 13:18
  • I think I've figured in out. The St.atus of the account must be AUTHORISED or VOIDED or PAID. Even then, some have the ItemCode and some don't – bugmagnet Sep 29 '22 at 13:37
  • 1
    Oh, that might be it - when I send invoices across the Xero, they're always set as authorised. But then I also don't send the two discount fields, so I wouldn't have missed them, and my traffic is one-way - I only retrieve invoices if something in my comms routine has stopped working for some reason. That doesn't happen often, but none of them have been missing item codes. – droopsnoot Sep 29 '22 at 17:08
  • 1
    These are my scopes: "offline_access openid profile email accounting.settings accounting.transactions accounting.contacts" – droopsnoot Sep 29 '22 at 17:09
  • To expose a detailed line items (for multiple invoices), you'll need to use the page parameter e.g. GET Invoices?page=1 – Doel Jangkrik Oct 04 '22 at 20:16

0 Answers0