Google Drive API for receiving access request notification - google-api

I am trying to integrate with Google Drive such that I can receive a notification whenever someone tries to request access for any file in my drive. But, I could not find any such API for that.
I have integrated with Google Drive Watch Changes API, but it doesn't push any event for access requests, otherwise, it works fine. I have also checked List Changes and Query Activity api whether it has any change for such case, but I could not find any such change/activity.
I found out that Slack can receive such notifications which means it is possible somehow. Kindly help, if you know how can it be done.

I assume that your goal is to record each time that someone opens any file in your Drive. If my assumption is correct, then you could use Apps Script API to accomplish your goal. You should create an onOpen() trigger that saves the user interaction (you may want to send yourself an email with MailApp), and apply it to every file that you want to monitor. You can take these project management examples as a reference. Please, ask me any additional doubt about this approach.

Related

Add multiple events in Google Calendar using batch request

I want to add multiple events in google calendar using google calendar API. I am thinking of using batch request for the same but unfortunately, I couldn't find any helpful pkg or article to help me send batch request using golang.
can anyone please explain me how to send batch request to google calendar to insert event using golang.
Thank you!
The first thing you need to consider is why you want to bother with batching
Batching is not going to save you quota, in some case it will increase the likly hood that you will get a flooding error. All batching saves you is the number of HTTP calls.
You're limited to 50 calls in a single batch request and they must all be to the same authorized user. So unless you are planning on inserting a large number of events to a single users calendar there is really no reason to work out batching.
That being said from what i can see the google-apis-go-client does not support batching and they dont intend to add it. Which would mean that if you do in fact want to add batching you will need to check the first link i posted and code this manually yourself.

How can I let others read and edit a google sheet (not shared with them) using googleapi, without them having to download credential?

I am a beginner trying out api for fun.
The problem is, lets say, I want to write a simple windows program with golang to let my friends read and edit one of the sheets saved on my google drive. How can I do this without having them download a credential file?
What I want it to do is simply redirect them to the Oauth Page right away, and if their email address is one recognized by the app it will grant them access to that google sheet.
What i think you need is to integrate your go app with Oauth protocol.
More specifically, with the Google provider.
This is mainly 3 steps:
add the oauth client to your application
something like this: https://github.com/golang/oauth2
See their docs on how to do it.
go to google dev documentation and see how to integrate google auth flow into the client: https://developers.google.com/identity/protocols/OAuth2
I'm not sure if google has something more specific for google drive integration and/or go-lang client in particular. Please do some searching.
make the glue code on your go app so that the user can interact with this (the login button (or command, if it is terminal based), error messages, logout, etc)
More questions will appear when you start to do this, however it is a great example to learn Oauth as well.
General guidelines:
https all the queries or oauth is basically useless
oatuh has many auth-flows and you must choose which one(s) you support. use whatever google documentation recommends for m2m scenario (machine 2 machine)
log errors so that your friends can send you a log file for you to debug issues
maybe set some feature flag so that you can simply disable this feature to run/test localhost ? maybe useful? you decide.

Extending YouTube API Quota with limited funds

With a simple java program, I send GET requests using YouTube Data API specifically videos.list, in order to get the public metadata of a video and store it as .json files.
For my universities research, we have to do this with all available YouTube video IDs provided in the Youtube-8M Database.
Therefore, I would like to know if there is a way to extend the available quota for requests (I already know about the billing option, but I am a student and my university is small).
I have read the YouTube API terms, which states that only one project per client may be used to send such requests with the necessary API Key.
If I understand it correctly, even my simple java code is such a client.
In some other Stack Overflow questions about extending ones daily quota with API Keys, some suggested creating multiple accounts or projects.
Is this a legal option or not? Or is there another possibility to get a higher quota for simple requests used in research like I do right now?
If you go to the Google Developer console where you enabled the YouTube API. the second tab is called quota
Click the pencil next to which ever quota it is that you are blowing out. A new window will pop up with a link called apply for higher quota.
Fill out the form to apply. To my knowledge you do not have to pay for additional YouTube quota but it can take time to get approved. Make sure you comply with everything on the form.
I have never heard of the one project per client term. Technically you can run your application using different API Keys it should work fine. Technically there is nothing wrong with creating additional projects on Google Developer console. You don't need to go as far as creating another Google account.

Parse AppOpened event track push notification consumption via Rest API

I'm trying to track an AppOpened event via Parse.com's Rest API, specifically related to the consumption of a push notification via a POST to https://api.parse.com/1/events/AppOpened
Since there's really no documentation on doing this, I was hoping adding a "push_hash" key inside the data sent to Parse would be enough, but I guess I'm just not that lucky.
Does anyone know what the required data for tracking push consumption via an AppOpened event is? I couldn't find anything online and was really hoping someone here could help (especially considering every support page they have points here).
Thanks~
You are right, there poor documentation but from other hands some people already meet this issue. And you can check their code for your situation:
Setting up a App Opened event
App-Open Analytic
Track App Opens with JavaScript
Try to use anything from this (use app & REST keys) and describe your result more detailed.

Transferring ownership of a specific Google Doc file using google-api-ruby-client

I'm looking to transfer ownership of a specific Google Docs file using the Google Apps API. There are many accounts on a single Google Apps domain. There are many files I would like to transfer so I do not want to do it manually.
In the UI I've only seen the ability to transfer ownership of all files from a particular user rather than individual files.
I've looked through the GitHub page for the google-api-ruby-client gem, but I was unable to come up with a solution. Can someone point me in the right direction or post an example?
You'll need to use the Google Drive API. Specifically the Permissions "update" method.
First find/get the File ID, using the Files.List method, which will allow you to search using a query. Then use the Permissions.Update (or Patch) method, making sure to set the transferOwnership parameter to True.
Full documentation is here: Google Drive API - Permissions

Resources