IntelliJ Java IDE
The moose likes Other JSE/JEE APIs and the fly likes Google Translator showing Google returned the following error: [403] Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Reply Bookmark "Google Translator showing Google returned the following error: [403]" Watch "Google Translator showing Google returned the following error: [403]" New topic
Author

Google Translator showing Google returned the following error: [403]

RatiKanta pal
Greenhorn

Joined: Nov 13, 2011
Posts: 7
Heloo every one..



import com.google.api.translate.Language;
import com.google.api.translate.Translate;

public class TestGoogleTranslate {
public static void main(String[] args) {
Translate.setHttpReferrer("http://translate.google.com/");
try {
String translatedText = Translate.execute("Heloo Every One", Language.ENGLISH, Language.GERMAN);
System.out.println(translatedText);
} catch (Exception ex) {
ex.printStackTrace();
}
}
}





In above code I am trying to translate my english text to german.But when I am running this I am getting exception like this


java.lang.Exception: Google returned the following error: [403] Please use Translate v2. See http://code.google.com/apis/language/translate/overview.html
at com.google.api.translate.Translate.getJSONResponse(Translate.java:182)
at com.google.api.translate.Translate.execute(Translate.java:71)
at TestGoogleTranslate.main(TestGoogleTranslate.java:9)



For this I am using google-api-translate-java-0.92.jar ..What may be the problem..I had already refered to http://code.google.com/apis/language/translate/overview.html.. But getting no input to my problem..

Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 13842

Well, let's start with the very first sentence of the highlighted box on that page you linked to:
Google wrote:Important: Google Translate API v2 is now available as a paid service only


So you're saying you have already subscribed to this service and your account is paid up. Is that correct?
RatiKanta pal
Greenhorn

Joined: Nov 13, 2011
Posts: 7
No..I am just trying to use it for learning purpose only...Is there any other way to this.


Please help me out..


Thank you..
Rob Spoor
Saloon Keeper

Joined: Oct 27, 2005
Posts: 18368

Error 403 (Forbidden) means you're not allowed to use it with your current credentials. You will need an account to be able to use it. If you only want to try it out, check if there's a possibility to get a limited account (in time and/or functionality); if not then you have no choice but to pay for it.


SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 13842

To me there doesn't seem to be much point in spending time learning something which you aren't going to use.
 
 
subject: Google Translator showing Google returned the following error: [403]
 
Threads others viewed
Google Code Playgroung
problem in functionality of google translate api
J2ee and Google docs integration.
Do any online search engines provide an approved API?
Unicode related
WebSphere development made easy
without the weight of IBM tools
http://www.myeclipseide.com

cast iron skillet 49er

more from paul wheaton's glorious empire of web junk: cast iron skillet diatomaceous earth rocket mass heater sepp holzer raised garden beds raising chickens lawn care CFL flea control missoula heat permaculture