List Active Channels in Google Drive API - google-drive-api

I can watch several files for changes delivered by webhook. If I lose the list of channels created (per file watched), how can I get a list of existing / active channel ids, so that I can cancel them when I'm done with them?
Feature Request: https://issuetracker.google.com/issues/173730342 Please +1 / comment to encourage google to provide this. Thanks.

There's no API method to list the channels. You should keep the information identifying the channel, which is returned when creating the channel and when receiving the corresponding notifications.
File a Feature Request:
I can't see any Feature Request regarding this in the Drive component in Issue Tracker, so I'd suggest you to file one.
Update - Feature Request filed:
Feature Request: List Active Channels
Reference:
Channels
Push Notifications

Related

[Adyen][POS][Local integration] Send metadata to the terminal

Currently, I try to send SaleToAcquirerData metadata to the terminal when the order to sync to Adyen Backend, I have checked at Adyen Backend but don't see metadata and my webhook cannot receive metadata
I need to send metadata to the terminal and receive metadata at my webhook
In this answer, I expect that you
Already receive webhooks events and that your webhook is well configured
That you receive core data from webhook events but that the POS related additional data is missing
Have you activated the POS additional data for this specific webhook?
You can do it in the Customer Area, Developer -> Webhook, select your webhook and then "Additional settings".
The UI looks like this :
Save, and exit. Your future webhooks events should contain POS metadata. Please note that you may still receive some events without the metadata that you except, because they were already generated at the time they were created.
EDIT : In case you want to use the API for this, you can also PATCH the existing webhook with additional settings using the new Management API.
While waiting for extra information, your question may be understood another way : You want to access the metadata field of the additional data section of a webhook event.
In that case, these metadata fields should be submitted at the time of payment in the POST /payments request.
You can find more information about this in the Webhooks documentation.

Is there a way to automatically delete emails from a Google Workspace Google Groups?

I was wondering if there is a way to automatically (or on a trigger) delete emails from a Google Group.
I use a Collaborative Inbox Group for archiving automated emails.
I looked at the Google Apps Script overview for Google Groups, but I don't see anything. It only seems like you can do this from GmailApp...
I also read this thread from 2012 but nothing helpful there
Answer:
Programmatically this isn't possible.
More Information:
The GroupsApp class of Apps Script only has read methods available for use - there is not a way of executing any write data using the class - for example deletion of emails.
Emails are sent to everyone in the group when a post is made (as per subscription settings). If you want the Email to be deleted then as you have already pointed out, you will need to use GmailApp to delete it from the recipients' inboxes.
In short: All mailbox manipulation must be done using the Gmail API (or GmailApp).
Feature Request:
You can however let Google know that this is a feature that is important for access to their APIs, and that you would like to request they implement it.
Google's Issue Tracker is a place for developers to report issues and make feature requests for their development services, I'd urge you to make a feature request there. The best component to file this under would be the Admin SDK component, with the Feature Request template.

Using search bar in Google Drive Picker shows no results and throws internal error in network response

I have the Google Picker API implemented in an application, with the Google Drive view included. Currently, entering a search query in the search bar of the Google Drive view starts showing a drop-down with some file results included, like this:
search bar drop down
However, clicking the "magnifying glass" search button, or pressing enter, or clicking "search for all items containing...", all results in an empty picker, like this:
empty picker with no search results
I believe this is occurring because a call to https://docs.google.com/picker/pvr is returning this error as a response every time: &&&START&&&{"error":true,"errorMessage":"Internal error"}.
The parameters being sent to that /pvr endpoint are here:
start: 0
numResults: 50
sort: 3
desc: true
q: testing
cursor:
mine: 2
service: docs
type: NOT_COLLECTION
options: {"ff":true,"filterTeamDriveResults":true}
token: J********
version: 4
app: 2
clientUser: 1************
developerKey: A*************
subapp: 5
What I found is that manually removing the "filterTeamDriveResults":true key from the "options" hash and doing an ajax post directly resulted in a successful request, but for whatever reason that option is included with every request from the picker, and any time a request is made with that option included, it seems to fail with the same "Internal error" response. I'm wondering what the source of that option is, and if there's any way to remove it from our picker. As far as I can tell it doesn't seem to be controlled by any of the options in the JavaScript API that we're loading from https://apis.google.com/js/api.js?onload=onApiLoad.
This started happening to us last week as well after having been using the Google Picker API for years without any issues. Your clue about the filterTeamDriveResults key reminded me of something I had just read, about upcoming changes to the Google Drive API and Google Picker API:
Next, we’re introducing a new Drive API resource collection, called “Drives,” to replace the “Team Drives” resource collection. This new resource collection can help you create, delete, get, list and update your shared drives, and features all the same fields, resources and available methods as the “Team Drives” resource collection. If you have been using the “Team Drives” resource collection in your applications, consider migrating as soon as possible as all related fields for Drive API , Drive Activity API and Google Picker API, will no longer be supported starting June 1, 2020.
It doesn't seem related, at least not directly, but made me think that perhaps, the SUPPORT_DRIVES feature that I had seen here in the docs, could "disable" that other teamDrive feature (even though it's not really that, but still...). And indeed, that fixed it. Basically just:
new google.picker.PickerBuilder().
setAppId(appId).
addView(new google.picker.DocsView().setIncludeFolders(true)).
enableFeature(google.picker.Feature.SUPPORT_DRIVES)
...
One thing to notice is this warning when enabling this feature:
Before enabling this make sure to refer to Google Drive API documentation for enabling shared drives and make any necessary Drive Rest API changes.
Might be relevant in your case.

When creating a push notification channel using the Google Drive API (v3) does setting payload to true in the request body do anything?

I would like to receive metadata or a summary of changes in my push notifications from the Google Drive API.
It would appear from the documentation that setting payload to true in the request body would accomplish this. As far as I can see, both file and change notifications do not include a request body even when payload is set to true when the notification channel is created.
The documentation states that payload is "A Boolean value to indicate whether payload is wanted. Optional."
Does anyone have any idea what this field does (if anything) and whether there is a way to include additional information?
If we check with other Google APIs with similar payload request usage, it looks like a flag to determine if the message body should be included in the notifications.
Take a look at the Google Admin SDK Push Notification, its almost similar with Drive API push notification is doing.

Google Drive SDK, How to check if a file has been shared outside of the domain by using Permission feed

I am using Google Drive SDK for .NET. Everything is working as expected, except that whenever I get the permission feed for a particular document. I get the Id, kind, name, role, selflink and type fields on permission.
There is no mention of the email address of the user which is stopping me from recognizing by reading the permissions, whether a file has been shared inside the domain or outside of the domain.
I can't use Google Docs API to get the ACL on doc because I am writing an app for users over 200000 users and I will need speed which is provided by Google API Console.
What should I do?
Thanks
You can use the Documents List API to get the email addresses. I'm curious why you believe Drive is faster than Documents List, for most API calls they have a comparable response time.
https://developers.google.com/google-apps/documents-list/#retrieving_the_acl_for_a_document_file_or_collection
Thanks for the idea but can I use Document List API with the Service Accounts provided through API Console?
Why do I believe that Google Drive SDK is better? Because we don't have any control over Document List API where we can set QPS (Query per second) limits or not that I know of.
Secondly, with Document List API when you make request to servers, in the past I had to create a fault tollerent algorithm in such a way that if one request fails second should go after 2 seconds if that fails then make your next request after 5 seconds until 7 second delay.
So, I don't think that Document List API would be a good fit for processing documents over 200000 users everyday unless Google has changed the way their API used to behave?