Xero - beautiful accounting software

Xero Developer Help Center

Xero Developer Community

Community > Getting Started >

Google Sheets / Xero integration - how to filter results?

Started by Caspar Clark -   in Getting Started

Hello all,

Pretty new to APIs and google scripts.

This has been driving me crazy for the past few days. I have used this code as a framework for pulling invoice line item data from xero:

https://github.com/rakesh456/xero-api-apps-script

The problems I am repeatedly coming across is that we have so many invoices that calling the API results in over 80 pages of data, and then causes G-script to exceed its maximum permitted runtime.

The obvious solution is to reduce the amount of data coming over the API, preferably using the if-modified-since property, or by filtering by invoice date.

However, no matter what I try, I cannot get either of these filters to apply, and it still returns all the data.

var headers = { "User-Agent": this.userAgent, "Authorization": authHeader, "Accept": "application/json"; "if-modified-since": "2018-01-01T00-00-00.00"};
var options = { muteHttpExceptions: true, "headers": headers};
var response = UrlFetchApp.fetch(requestURL + '?page=' + pageNo, options);


Also, if i wanted to add multiple parameters to the query, to filter by invoice date, or by a range of contact names, where would i need to add them? I've tried amending the var signBase and the var authHeader variables to include them (and ensured they appear in alphabetical order) but that causes the whole API call to fail oauth signing.

Has anyone managed to get this to work? someone else must have surmounted this problem?

Unfortunately I need to use google sheets for this integration, and I know that has its limitations here.

thanks for your help in advance,

C
Hey Caspar,

I would DM you, but Xero community doesn't have that feature.

I'm afraid I can't help you because I'm just starting off integrating too. But you're even further ahead than me.

How did you get started integrating and automating with Xero. I'm keen to maximise automation in my role, but don't really know where to start (the Xero Developer how-to guides have a lot of assumed knowledge). Could you please point me to some handy resources?

Thanks,
Blair
 

Blair Mottau  

Dear all,
Where I will get RSA key to connecting Xero app with google apps script,
Is RSA key and certification key when we create private is the same?

I am looking solution from last 6 month, Please give a solution for this.
 

mohammad HUSSein