마스터Q&A 안드로이드는 안드로이드 개발자들의 질문과 답변을 위한 지식 커뮤니티 사이트입니다. 안드로이드펍에서 운영하고 있습니다. [사용법, 운영진]

Google Translate Api v2 이 에러 나는 이유가 뭔가요 ?

0 추천

 

먼저 URL은 다음과 같이 구성했습니다.

 

List<NameValuePair> param = new ArrayList<NameValuePair>() ;
param.add(new BasicNameValuePair("key", API_KEY)) ;
param.add(new BasicNameValuePair("source", "ko")) ;
param.add(new BasicNameValuePair("target", "en")) ;
param.add(new BasicNameValuePair("q", st)) ;
 
String my_url = "https://www.googleapis.com/language/translate/v2" + "?" + URLEncodedUtils.format( param, null) ;
 
그리고 HttpGet방식으로 요청을 하면, 403 에러가 나면서
 
respose : {
"error": {
"errors": [
{
"domain": "usageLimits",
"reason": "ipRefererBlocked",
"message": "There is a per-IP or per-Referer restriction configured on your API key and the request does not match these restrictions. Please use the Google Developers Console to update your API key configuration if request from this IP or referer should be allowed.",
}
],
"code": 403,
"message": "There is a per-IP or per-Referer restriction configured on your API key and the request does not match these restrictions. Please use the Google Developers Console to update your API key configuration if request from this IP or referer should be allowed."
}
}
 
이렇게나옵니다.
 
키 제대로 생성했는데 왜 200 성공이 안뜨는지 모르겠습니다.
 
제발 도움좀 부탁드립니다.

 

음무 (17,820 포인트) 님이 2015년 8월 7일 질문

1개의 답변

+1 추천
 
채택된 답변

There is a per-IP or per-Referer restriction configured on your API key and the request does not match these restrictions. Please use the Google Developers Console to update your API key configuration if request from this IP or referer should be allowed.

 

IP를 허용해주세요.

달기살 (12,990 포인트) 님이 2015년 8월 7일 답변
음무님이 2015년 8월 31일 채택됨
Android key인데 IP를 허용해야하나요 ? https://cloud.google.com/translate/v2/using_rest 가이드에 IP Address 언급된게 Server Key발급시밖에 안보이는데
IP허용은 어떻게 해야하나요 ?
...