Please find attached!
{ | |
"id": 11084391, | |
"name": "Harris, Mark", | |
"term_grade": | |
{ | |
"comments": "<p>observ comment</p>", | |
"rubrics": | |
[ | |
{ | |
"id": 6484, |
/** | |
* Get an overview table of all items returned from the endpoint, useful for when there lists of objects are returned. | |
* See comments below for screenshots. | |
* | |
* https://gist.github.com/brainysmurf/e45f608b68609f8a0b222ac99b8905d8 | |
* | |
* To use, copy the below code into the "Tests" tab of the endpoint | |
* Click blue "Send" button | |
* Click on "Visualize" in the Body tile | |
* Note that it only displays the returned objects, there's nothing magical that's getting "all" objects via pagination |
/** | |
* Append a 2d array to an existing sheet or can create a new sheet | |
* to match the largest row in the dataset. | |
* davidsottimano.com | |
* @param {array} data 2d array of data | |
* @param {string} sheetName (optional) The sheet you want to output to. If the sheet does not exist, this script will auto-create a new sheet with the specified sheet name. If the sheetName is not specified, a new sheet will be created | |
*/ | |
function outputToSheet(data, sheetName=null) { | |
const ss = SpreadsheetApp.getActiveSpreadsheet(); | |
if (sheetName==null) sheetName = 'Default Sheet Name'; |
After a few months of using my Endpoints library to help solve myriad of problems in production, I've only had anecdotal evidence that it was a "way more" performant way of interacting with API endpoints, compared to more traditional method of using AppsScripts advanced services. So I decided to actually measure it.
In my domain, there are 26 google groups, a set for each grade in the school, where a set is one for students and one for parents. We have about 30 students per grade, which means membership of the each students group is about 30, but for the parents, it is twice that (as both parents are a member).
With two different code bases, I download all memberships of all these groups.
function measure_({func, arr}) { | |
const start = new Date().getTime(); | |
func.call(null, arr); | |
const end = new Date().getTime(); | |
const delta = end - start; | |
const report = `${func.name} took ${delta} milliseconds`; | |
Logger.log(report); | |
return delta; |
/** | |
* This is my version of what I embed into libraries I want to track, as cluster. | |
* This way it ensures that consistent name, version used throughout, and easy to define namespace | |
* Note use of "name" "space" parameters | |
*/ | |
function TrackMyself ({name='dottie', space=null, version='v1.5', ...kwargs}={}) { | |
if (Object.keys(kwargs).length>0) throw new TypeError("Unexpected param received"); | |
const track = cttLibTracker.TrackMyself; | |
const options = { |
Hi there! This gist is a bit outdated. The good news is that you can go here instead:
As of May 2021, it is actively supported.
function resolveAlias_(email) { | |
var resp, ret; | |
try { | |
resp = AdminDirectory.Users.Aliases.list(email); | |
} catch(e) { | |
if (e.message === 'Resource Not Found: userKey') { | |
return null; | |
} | |
return null; | |
} |
function work_ (url, {UrlFetchApp_=UrlFetchApp}={}) { | |
Logger.log(url); | |
return UrlFetchApp_.fetch(url).getContentText(); | |
} | |
function testWork() { | |
const url = 'https://example.com'; | |
const response1 = work_(url); | |
Logger.log(response1); | |
class Mocked { |