I've been trying to get a Google App Script together that works with Google's Directory API to update a large number of groups.
To my knowledge Google App Scripts uses javascript. I can't find a library to import or a json.stringify function to copy/paste into my code. Does anyone know of one?
I have the following code after the necessary authentication steps.
var options = {
'method' : 'Post',
'contentType' : 'application/json',
'followRedirects' : true,
'muteHttpExceptions': true,
'headers': {Authorization: 'Bearer ' + service.getAccessToken()},
'payload' : JSON.stringify(data)
};
var url = "https://www.googleapis.com/admin/directory/v1/groups/" + groupkey + "/members";
var response = UrlFetchApp.fetch(url, options);
Logger.log(response.getContentText());
}
Error Message:
TypeError: Cannot find function stringify in object [object Object]. (line 219, file "Code")
function myFunction() { Logger.log(JSON.stringify(new Date(2006, 0, 2, 15, 4, 5))); // '"2006-01-02T15:04:05.000Z"' Logger.log(JSON.stringify({ x: 5, y: 6 })); // '{"x":5,"y":6}' Logger.log(JSON.stringify([new Number(3), new String('false'), new Boolean(false)])); // '[3,"false",false]' }data?