2

I'm investigating Google Drive's real-time API. In the QuickStart Tutorial the JavaScript library loaded is https://apis.google.com/js/api.js. The Drive documentation describes this library as the Google JavaScript API loader. This library seems to load the appropriate libraries for the services we need to interact with.

But when looking at QuickStart Tutorial for Google Drive (non realtime) it seems to load https://apis.google.com/js/client.js which I believe is the library documented here.

My question is what is the difference between api.js and client.js. They seem to have similar purpose although don't work in the same way. Is api.js for certain Google API's while client.js is for others? Is api.js documented somewhere like client.js is?

Eric Anderson
  • 3,692
  • 4
  • 31
  • 34

2 Answers2

3

The content of those two files are (nearly) identical, and in fact it seems you can put any name before .js and it will load the same file. That said, I'd recommend sticking with the file names shown in the documentation, as those are guaranteed to work.

Eric Koleda
  • 12,420
  • 1
  • 33
  • 51
  • 1
    Interesting about any file working. I'm guessing it relates to the way Google's script loader works. The way the files are used in the example were different which made me think the API was different. But comparing the actual file show they are mostly the same. I guess it's just something internal to Google that we will never know. :) – Eric Anderson Jun 23 '14 at 00:24
0

Use links only from the documentation!

Simple to check this:

1) Add to header of your page this script:

<script type="text/javascript" src="https://apis.google.com/js/client.js"></script>

Open DevTools -> Network I see:

for client.js

2) Change link to other script

<script type="text/javascript" src="https://apis.google.com/js/api.js"></script>

Open DevTools -> Network

I see:

enter image description here

api.js is the core, when client.js is the module.

Here a completely different content: https://apis.google.com/js/platform.js

Additional information: https://stackoverflow.com/a/33281791/5754223

Community
  • 1
  • 1
artamonovdev
  • 2,260
  • 1
  • 29
  • 33