开发者

Changing gmail Settings with Ruby

I need to configure my gmail account(s) programmatically with Ruby. I checked out the apps api and it looks like the simplest possible solution wou开发者_运维问答ld be to use ClientLogin for logging in and a simple XML PUT for changing the forwarding setting, for example.

I wrote a little test script like so:

http://gist.github.com/373457

It would appear that the call to ClientLogin works because it comes back with an Auth= token. When it sends the PUT request to google, however, it comes back with a RestClient::Unauthorized exception. I rewrote the script with pure net/https and it turns out the message I'm getting is invalid token, yet I can't figure out what is wrong with my token. Can anyone else see it?


I noticed you are using service=mail in your ClientLogin script. The correct value to be used for the Email Settings API is service=apps. Also, use accountType=HOSTED instead of accountType=Google.

Are you using a Google Apps domain administrator to send your requests? The Email Settings API can only be used by domain administrators and in Google Apps for Business, Education and ISPs editions only.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜