Does anybody know if via the google api in java I can create google accounts programmatically.
You can do that theoretically, but Google's account creation - like other services - uses image recognition for confirmation that you're a user (aka CAPTCHA) and you need to be able to write image recognition program that can do that.
AFAIK there's no programmatic API from Google to create accounts, since doing so would open them up to spammers/scammers/etc... which the CAPTCA was meant to prevent.
Why would you do that? I am not sure Google allows that in the first place as far as EULA.
The fact that Google's account creation UI requires a CAPTCHA is your first hint that the answer is NO.
NO
The only possible way to do this would be to use a web automation framework. Python is great for web automation using tools such as mechanize. I've never done it in Java, but you should do a google search for java programmatic web browser
or java web automation
.
On top of that you would have to incorporate an OCR package to beat the captcha.
There is a reason that google, nor anyone else, allows the programmatic creation of accounts. Spammers would have a field day. Within days there would be no valid accounts left for any new users to use. In short, it would be a disaster.
Ask Google - if you give them money I'm pretty sure they will allow you quite a lot.
As others have pointed out, you cannot create Google consumer accounts (ie, @gmail accounts) via any sort of API. It would create a field day for Spammers. To make it difficult for Spammers, Google uses tactics such as CAPTCHAs to prevent abuse.
But, you can create Google Apps accounts via their Provisioning APIs. A Google Apps account is basically a white labeled version of Google Apps (Gmail, Calendar, Docs, etc) that is under your own domain name.
For the same Spam concerns, your Google Apps account would have to be either a Premier domain (where you pay for every account you provision) or an Educational institution (I assume some sort of verification process for that). So, since you have to pay for each account, it's not a huge risk for spammers (unless they want to pay big $$$ for each account.. very unlikely).