0

I am using the xero-node SDK.

I use the getInvoices entry point, and everything works fine meaning that the Invoice data is correct. The Contact JSON object is also returned with the Invoice data (which surprised me) which contains the Contact associated with this invoice.

However, Contact data is blank other than the ContactID and the Contact name. Why would the API return a blank object? This means I have to make an extra call to get the 'real' Contact data. Doesn't make sense.

ImTalkingCode
  • 353
  • 1
  • 3
  • 14

1 Answers1

1

As it says in the Xero API documentation:

When you retrieve multiple invoices, only a summary of the contact 
is returned and no line details are returned - this is to keep the 
response more compact.

If you retrieve a single invoice, you'll get more of the contact information.

https://developer.xero.com/documentation/api/accounting/invoices

droopsnoot
  • 931
  • 1
  • 7
  • 11
  • It sends back the entire structure with all fields blank. But anyway, it doesn't matter. I will just call the APIs to get Contact Info on each invoice. It is strange behaviour though. – ImTalkingCode Jul 05 '22 at 07:33
  • 1
    I wonder if that's to do with the way that the Node SDK deserialises the object that Xero returns, rather than the actual raw data that Xero returns. I call the endpoints directly rather than using an SDK, and generally speaking (I don't usually need to retrieve more than one invoice at a time, so haven't tested this specific call) the return is as described on the site. – droopsnoot Jul 05 '22 at 10:52
  • I would use the raw API but could not for the life of me get the exchange code call to work . Tried everything. I mimicked the code in the docs exactly. Always came back with invalid-grant. – ImTalkingCode Jul 06 '22 at 11:07
  • 1
    I'm only using it because I found all the async stuff in .net too complicated, and as I run as a service it doesn't matter if it has to wait a second or two for a response - the user doesn't see it. – droopsnoot Jul 06 '22 at 11:29
  • Can you show me how you implemented the 'exchange code' code. Either here or a PM. Thx. – ImTalkingCode Jul 06 '22 at 22:39