Xero - beautiful accounting software

Xero Developer Help Center

Xero Developer Community

Community > API Authentication >

Xero Google Scripts Authentication with parameters

Started by Danyal Khan -   in API Authentication

I am using a google script to get a profit and loss report and I am able to get the report with the oauth authentication using this as the url:

However, when I add a parameter like:

The response that I get is:

Can anyone please help with this.
Best Reply as chosen by Danyal Khan (Original Poster)
Just in case someone comes back here.

The solution that worked for me is to encode the parameter in the signature base:

var signatureBase = "GET" + "&" + encodeURIComponent(URL) + "&" + encodeURIComponent("oauth_consumer_key=" + CONSUMER_KEY + "&oauth_nonce=" + oauth_nonce + "&oauth_signature_method=RSA-SHA1&oauth_timestamp=" + oauth_timestamp + "&oauth_token=" + CONSUMER_KEY + "&oauth_version=1.0" + '&trackingCategoryID=abc123&trackingOptionID=123abc');

And also add it to the fetch url:

UrlFetchApp.fetch(URL + '?trackingCategoryID=abc123&trackingOptionID=123abc', options);

This should work for other parameters as well.

Danyal Khan