Skip to content

Instantly share code, notes, and snippets.

@gslokoski
gslokoski / httpGetTemplate.gs
Created September 2, 2019 09:42 — forked from mogsdad/httpGetTemplate.gs
Google Apps Script template functions for external host communication with UrlFetchApp. See https://mogsdad.wordpress.com.
/** * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* httpGetTemplate.gs
*
* A pair of template functions for external host communication with
* UrlFetchApp, including parameter encoding and error handling.
*
* From: gist.github.com/mogsdad/a76c32231a2b91ff8b59
*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
function getPO() {
var oauth_nonce = createGuid();
var oauth_timestamp = (new Date().valueOf()/1000).toFixed(0);
var CONSUMER_KEY = 'CONSUMER_KEY'
var PEM_KEY = '-----BEGIN RSA PRIVATE KEY-----'+
'PEM_KEY'+
'-----END RSA PRIVATE KEY-----';
var payload = '';
var URL = 'https://api.xero.com/api.xro/2.0/purchaseorders';
var signatureBase = "GET" + "&"
@gslokoski
gslokoski / gscript-xeroapi
Last active February 12, 2019 15:56
Testing csi-lk/google-app-script-xero-api for use with pulling POs
function getPO() {
var oauth_nonce = createGuid();
var oauth_timestamp = (new Date().valueOf()/1000).toFixed(0);
var CONSUMER_KEY = 'CONSUMER_KEY'
var PEM_KEY = '-----BEGIN RSA PRIVATE KEY-----'+
'PEM_KEY'+
'-----END RSA PRIVATE KEY-----';
var payload = '';
var URL = 'https://api.xero.com/api.xro/2.0/purchaseorders';
var signatureBase = "GET" + "&"