wood burning stoves 2.0*
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 | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
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
Ranch Hand

Joined: Nov 13, 2011
Posts: 62

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: 18541
    
    8

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
Ranch Hand

Joined: Nov 13, 2011
Posts: 62

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
Sheriff

Joined: Oct 27, 2005
Posts: 19656
    
  18

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 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

To me there doesn't seem to be much point in spending time learning something which you aren't going to use.
 
Don't get me started about those stupid light bulbs.
 
subject: Google Translator showing Google returned the following error: [403]
 
Similar Threads
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