Can anything done with google apps scripts be done with the google API?

冷暖自知 提交于 2020-02-25 04:15:27

问题


I noticed that the Google Apps Script editor uses a Bearer token to make requests for a lot of things, that got me thinking: Is it possible to do all functions that are done with the google apps script with the google API on your own server? What is the essential difference? Just the fact that google apps script runs on google servers, while with the google API you would need to create your own servers?

For example many of the document functions, which I thought could only be done with the API, turns out can be found here https://developers.google.com/docs/api/reference/rest/v1/documents/request#InsertInlineImageRequest

so whats the essential difference?


回答1:


Just the fact that google apps script runs on google servers, while with the google API you would need to create your own servers?

Yes. There are advantages to both methods:

API:

  • It's a rest API. You can use your own language(eg: Python) in your servers.
  • The api is more inclusive. There are stuff which can be done with the api, which cannot be accomplished with apps script.
  • User can set limited scopes for using API.
    • For example, at Drive API, https://www.googleapis.com/auth/drive.file can be used for Drive API. The same cannot be done with DriveApp of apps script.
  • Process cost of API is lower than that of the built-in methods for Google Apps Script1 2

Apps script:

  • No server on your side
  • Triggers. You can set up functions to run onEdit,onOpen or at a specific time.
  • Deep integration with Google apps: Sidebars/modal dialogs can only be done with apps script.
  • All methods of the api can be accessed indirectly through the bearer token.
  • Authorization/authentication is taken care of by apps script. You don't need to set up oauth.


来源:https://stackoverflow.com/questions/60246626/can-anything-done-with-google-apps-scripts-be-done-with-the-google-api

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!