Xero - beautiful accounting software

Xero Developer Help Center

Xero Developer Community

Community > Wrapper libraries >

Retrieving multiple invoices with nodejs library ( xero-node )

Started by Martin Thompson -   in Wrapper libraries

Currently there are 2 nodejs SDK's , one for oAuth 1.0 and one for oAuth 2.0

What I want to do is something like this ( using typescript )

import config from "config";
import {AccountingAPIClient} from "xero-node";

const xeroClient = new AccountingAPIClient(config.get("Xero"));
const po = await xeroClient.invoices.get({InvoiceNumbers:"invoice1,invoice2"})

The problem is that even though I think the API supports the parameter "InvoiceNumbers" - the nodejs wrapper doesn't

I haven't tried it with oauth 2.0 ( xero-node 4.0 ) - but what I am running is a back end process and I don't want to have to authorise the app periodically.

Ideas?






Hi Martin,

To be fair I haven't used to xero-node wrapper much yet, as we wrote our raw oAuth 2.0 integration for Xero before the wrapper came around!

That said with oAuth 2.0 there are a couple of things that may be potentially confusing that you need to be aware of.

1. oAuth 2.0 does not mean that you need a user to Authenticate every time
2. with offline access and refresh tokens, you can do what you need in oAuth 2.0

If you're still starting out I suggest upgrading to the oAuth 2.0 as oAuth 1.0 will be eventually, at some point switched off. If however you still have challenges with pulling in multiple invoices, feel free to reply here and see if I'll patch up the oAuth 2.0 wrapper to handle that scenario.
 

Jonathan Mifsud  

Ok thanks. are there any good examples of how to authenticate once and then not have to do it again?

I just tested it , and it looks like in oauth 2 , it should be working but it is not. the invoiceNumbers parameter is an array of type string but unfortunately it just returns all invoices. I can't post a code example here because it keeps saying "there was an error formatting your answer"



 

Martin Thompson