Google Apps has an "Google Apps Email Settings API" which allows to create a new mail filter via an API call.
Is there any (perhaps undocumented) way to get the list of current filters and update them?
Manage search filters in GmailFrom Gmail home, click Settings in the upper-right corner (represented by a gear icon). Select See all settings. Move to the Filters and Blocked Addresses tab. Check all the created filters in action.
The Gmail API is a RESTful API that can be used to access Gmail mailboxes and send mail. For most web applications the Gmail API is the best choice for authorized access to a user's Gmail data and is suitable for various applications, such as: Read-only mail extraction, indexing, and backup.
Setup the Gmail API The MFA service check will access the Gmail account to get the MFA code requested from the web page. First, we have to enable the API and authenticate to Gmail. This can be done by following their Quickstart guide. Click the “ENABLE THE GMAIL API” form button to generate the credentials.
A Filter object was added to the API that allows for filter processing, including retrieval, creation and deletion.
https://developers.google.com/gmail/api/guides/filter_settings
Specifically:
Listing Filters
GET https://www.googleapis.com/gmail/v1/users/userId/settings/filters
Returns a JSON list of Filter objects
Retrieving a specific Filter
GET https://www.googleapis.com/gmail/v1/users/userId/settings/filters/id
Returns a single JSON Filter object
Deleting a specific Filter
DELETE https://www.googleapis.com/gmail/v1/users/userId/settings/filters/id
Creating a Filter
POST https://www.googleapis.com/gmail/v1/users/userId/settings/filters
With a JSON encoded Filter in the request body.
While the REST URLs have v1 in the address, they are linked from the current documentation. Also note, GMail API migration is currently in progress, and the deprecated API will cease to function as of July 2016. Keep this in mind, as the API may change.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With