0

One of our Java applications uses a google API service account to process all the Google Drive Documents shared to it. As at the moment there is no REST API for manipulating the content of the documents, I plan to use a Google Apps Script with a time driven trigger for that purpose.

Could not find how to set up such a trigger for a google API service account. Needing some help. Thanks.

Sanjay

Community
  • 1
  • 1
Sanjay
  • 8,755
  • 7
  • 46
  • 62

2 Answers2

1

According to the Documentation, Time-Driven Triggers execute under the trigger owner identity. So it is not important which account type uses your Java Applications.

megabyte1024
  • 8,482
  • 4
  • 30
  • 44
  • As I know, for creating a trigger in an account, I will have login as that account, go to the script editor and create the trigger. But, because I can't login to a *google API service account*, I wonder how to create a trigger in that account. – Sanjay Jul 23 '12 at 11:45
  • @Sanjay. You have to have a normal Google user. To create a service account you had to use the API Console, to access the console you had to have a Google account. You can use this Google account to create triggers. – megabyte1024 Jul 23 '12 at 11:54
  • Okay. That means, as I understood, I 'll have to have the trigger run from my normal account, and can't have it run in the service account. Right? That's okay, but for that my normal account will have to have access to the documents, which I was thinking to avoid. – Sanjay Jul 23 '12 at 12:08
  • 1
    @Sanjay. I can make an assumption. It is impossible to create Time-Driven Triggers in a Service Account. Service accounts are designed to permit services (without any human involving) to access data via "REST APIs". For this target, there is no need to login like a human, via a Web Browser, to such kind of accounts (for this another accounts types are designed, "Installed Applications", etc). It is impossible to create GAS triggers via the REST APIs. It is possible to create triggers only in the Script Editor and the created triggers executed by the creator account. – megabyte1024 Jul 24 '12 at 07:01
0

There is no special trigger for google API service accounts Setting up a trigger is the same for any account. Have a look at the documentation on triggers for more information

Srik
  • 7,907
  • 2
  • 20
  • 29
  • But I could not figure our how to. For a normal account I can login and go to the script editor to create a trigger. But for a service account I can't login. – Sanjay Jul 23 '12 at 12:10
  • I assume, by service account, you mean a Google Apps account (@yourdomain.com) as against a consumer account(@gmail.com). There is no reason why the trigger menu should not show up in your Apps account. Raising an issue in the issue tracker might help. – Srik Jul 23 '12 at 12:44
  • No no. By service account, I meant [the ones](http://googledevelopers.blogspot.in/2012/03/service-accounts-have-arrived.html) we create through the [Google APIs Console](https://code.google.com/apis/console). – Sanjay Jul 24 '12 at 06:43
  • Not sure what your question is. What you get in the API console is access to APIs of various Google's services. These are not related to Apps Scripts. However, you can write Apps Scripts that can work with other APIs and you can have timed triggers. I can't fathom how timed triggers with service accounts are supposed to work. Do you have any sample code to illustrate ? – Srik Jul 24 '12 at 08:43
  • 2
    @Srik.The topic starter has a Java Application which manipulates Google Documents using the Google API or Google Data API. The Java App uses a special kind of authentication called "Service Account". The App should format the documents (change font size, change font color, etc). The APIs mentioned above do not permit this and the starter searches a way to do this using the Time-Driven Triggers, because GAS permits document layout manipulations. And here there is the problem. The triggers run under the creator access rights only and the starter does not want to permit this. – megabyte1024 Jul 24 '12 at 09:29