Random Neil deGrasse Tyson quotes
There’s probably no practical use to today’s API of the day, except that I am always amused by what he has to say. The other thing I wanted to look at was a slightly more complex usage of the restQuery capability, but at the same time to talk a little more about how this exposed interface could benefit from using jSon arguments rather than the traditional list imposed on us by VBA syntax.
As usual it is implemented as a rest-library member. This a single query API, populating a single row on each call, and with no query arguments. It will populate a spreadsheet row (Excel or Google Docs) for each quote received up to a maximum specified.You just name the columns to match any data you want to retrieve and go. Here’s an example of 10 random quotes in a Google Spreadsheet.
The rest library is itself implemented as REST API and can be queried like this.
Now when we take a look at the code this time, you will see the many optional arguments exposed by this function. In a future post I’ll demonstrate how to use jSon formatted arguments in both GAS and VBA to improve the usability of complex functions like these.