How can I manage Gmail labels using Google API?
I'm creating an aplication in GAE that uses the Google API. I need to manage开发者_C百科 the labels in a Gmail account, but I can't find an API that allows me to do the regular CRUD (create, delete and consult).
You could do that using a Google Apps Script. http://code.google.com/googleapps/appsscript/service_gmail.html
But It would be hard to integrate it with the rest of your GAE application.
Your Google apps script can run on a timely basis. So you can schedule it to run every 10 min, get a list of operations to do from your application using fetch and than do it.
Checkout this example. It uses the apps script on a timely basis to change the gmail labels. http://googleappsdeveloper.blogspot.com/2011/07/gmail-snooze-with-apps-script.html
You probably want to use JSON to communicate with your GAE application with the Google Apps Script. Just setup a url with all commands you wish to execute.
After the operation is complete you can use fetch again to post back to your application the operations that were completed or possible errors.
You can use the Email Settings API but note that is only available in Google Apps for Business, Education and ISPs:
http://code.google.com/googleapps/domain/email_settings/developers_guide_protocol.html
精彩评论