zorborac
zorborac

Reputation: 175

Add filter to gmail account via HTTP request?

I'm developing a chrome extension for gmail and I'm aware of the Admin SDK API

Admin SDK: managing filters

From everything I've read, I can't use this API with a standard @gmail.com address.

doing a POST to

https://apps-apis.google.com/a/feeds/emailsettings/gmail.com/2.0/me/filter

just results in a bad URL. I've allowed access to the admin SDK in the Developer's Console.

I have no problem using the other GMail API, my Oauth2 flow seems to work fine.

Has anyone had any luck programmatically creating a filter?

Upvotes: 1

Views: 437

Answers (2)

zencodism
zencodism

Reputation: 442

Reviving, I encountered this in my research for similar problem

Basically, even though Gmail Settings API won't let you and I found lack of documentation disturbing, there is a way to programmatically set a filter for logged in user. It requires simply issuing a POST request in gmail's page environment (script injection, likely browser extension). In answer linked above you'll find a working example; all paying credit to this small API project which greatly helped to set this up.

Upvotes: 0

Eric D
Eric D

Reputation: 7159

Yes, unfortunately, your findings are correct: it's not possible to do this currently for @gmail.com accounts (Gmail API exposes nothing about filters, Admin SDK is only for Google Apps domains).

Upvotes: 3

Related Questions