Somewhere to keep those API keys: google apps script rest library entry

In the builtwith.com api rest library entry for Excel I covered how to get data about a given web site using the builtwith.com API. I went against my usual rule here, by including an api that needs an API Key. Here’s how to securely store your API keys in one place, and use them without exposing them in your code. This is a subset of the topic, using scriptDB as a lockbox, and before it will work, you would need to follow the instructions there for publishing a scriptDB lockbox.

Assuming you’ve done that, here is the Google Apps Script code for getting your api key out, and running the rest query. You would just need to substitute mcpher.getMyStuff() with yourlibraryname.getMyStuff().

 

You would, of course had to have stored your own api key once off, with a function like this (again You substituting mcpher.getMyStuff() with yourlibraryname.getMyStuff() ) .

 

Here’s the final result (run on the ibm.com website)

The rest library entry is

 

Next post, I’ll show you how to get the same api Key into Excel, so you won’t need to hard code it into your VBA module.

About brucemcp 223 Articles
I am a Google Developer Expert and decided to investigate Google Apps Script in my spare time. The more I investigated the more content I created so this site is extremely rich. Now, in 2019, a lot of things have disappeared or don’t work anymore due to Google having retired some stuff. I am however leaving things as is and where I came across some deprecated stuff, I have indicated it. I decided to write a book about it and to also create videos to teach developers who want to learn Google Apps Script. If you find the material contained in this site useful, you can support me by buying my books and or videos.

Be the first to comment

Leave a Reply

Your email address will not be published.


*


seventeen + 14 =