APIs – configuring Google APIs and troubleshooting

XREF to Evernote: Learn; ITIL – API Scripting. Within this is my placeholder for what my API (Client ID and API Key) are kept.

Desired Outcome:
-Understanding, configuring, troubleshooting and test APIs
-Intro to scripting
-Analyze response codes in test HTTP server locally on Mac

Action Support
Old to New:

-Followed the Quickstart guide to create an API and do a test on my Mac. Started from this site — https://developers.google.com/apps-script/api
-Followed these instructions for Browser Quickstart – https://developers.google.com/apps-script/api/quickstart/js#python-3.x
-I have a Mac with OSMojave
-Local Python version is 3.x
-I have several Google Accounts with GoogleDrive enabled
-Created the index.html file and inserted the code from the site. Placed file within one of my GoogleDrive folders
-Modified the index.html (using TextEdit) for Client ID and API – entered from what I had stored in Evernote
-Started the WebServer on local Mac, at terminal prompt with: python -m http.server 8000 Keep in mind that I have Python version 3.x
-Within terminal it looks like this:
(base) Pauls-MacBook-Pro-2:API Tests PaulGarth$ python -m http.server 8000
\Serving HTTP on 0.0.0.0 port 8000 (http://0.0.0.0:8000/) …
127.0.0.1 – – [26/Oct/2020 14:57:41] “GET / HTTP/1.1” 200 –
127.0.0.1 – – [26/Oct/2020 14:57:51] “GET / HTTP/1.1” 200 –

-I’m seeing a couple things:
-When it says to load the URL – http://localhost:8000 in browser, I don’t see any web-page load. I see the contents of the index.html file loaded.
-Documentation said that first time through it would prompt to authorize access – didn’t see this
-Within the terminal, you can see “200”. I think this is a positive sign, but need to understand these codes more
-I had downloaded the credentials.json file and placed it in the same folder as the index.html file because not sure what it is for

Questions to answer:
Note: I followed instructions here – https://developers.google.com/apps-script/api/quickstart/js#step_3_run_the_sample
Q: Did I create the API correctly? (Client ID, API)
Q: Did I run the webserver correctly? – python -m http.server 8000
Note: Within this website, it gives additional details on the http server – https://osxdaily.com/2010/05/07/create-an-instant-web-server-via-terminal-command-line/
Q: What is the return code of 200 mean with terminal for http server?
Q: What is the credentials.json file that is created and how do I use it?
Q: For Managing APIS Credentials within API Console, how do I navigate this site? What am I looking for? Do I need to activate something? Note: There is something about a free trial and $300 of free credit.
Q: In order to use Google API’s, even for testing, will I be charged at some point?
Q: Did I authorize access for Google? Didn’t see this.
Q: What does this mean – After the initial user authorization, calls to gapi.auth.authorize that use immediate:true mode obtain an auth token without user interaction.
Q: How to navigate the Google Developers Console help documentation, that I found with: https://support.google.com/cloud#topic=3340599
Q: How to use the Google APIs Client for JavaScript documentation, that I found with: https://developers.google.com/apps-script/api/quickstart/js#step_3_run_the_sample
Q: How to use the Apps Script API reference documentation, that I found with: https://developers.google.com/apps-script/api/reference/rest
Q: What do the various troubleshooting tips at the bottom of these document mean?
Error: origin_mismatch
idpiframe_initialization_failed: Failed to read the ‘localStorage’ property from ‘Window’
idpiframe_initialization_failed: Not a valid origin for the client
This app isn’t verified.
Q: Have I gone too quickly into playing with APIs, vs spending more time with basic Python programming?
Q: What are the various resources mean within Apps Script API found here – https://developers.google.com/apps-script/api/concepts
projects
projects.deployments
projects.versions
processes
scripts

I found here – https://developers.google.com/apps-script/api/quickstart/js#step_3_run_the_sample

About Paul

CERT Coordinator, Ham Radio Operator, GTD Fan; Photographer; Domino/Notes Administrator
This entry was posted in API, Troubleshooting-InProcess, Web Development and tagged . Bookmark the permalink.