Reputation: 29
We have a website where in we need to translate this web site to artabic using google translate api. When I try doing this using c# back end code I'm getting this error when i make request with the api key uri .
error
System.Net.WebException: The remote server returned an error: (403) Forbidden. at System.Net.WebClient.DownloadDataInternal(Uri address);
I dont know where is the mistake can anyone help?
This is how my uri is formed string l_strURL ="https://www.googleapis.com/language/translate/v2?key=xxxxxxxxxxxxxxxxxxxxxxxxxxxxx&source=en&target=ar&q=" + in_strString;
var in_string is the data to be translated
This is my code
string l_strTranslation = in_strString;
try
{
WebClient l_oWebClient = new WebClient();
string l_strResult = "";
//Notify the webclient we're expecting UTF-8
l_oWebClient.Encoding = System.Text.Encoding.UTF8;
//l_oWebClient.Credentials = credentials;
//l_oWebClient.Credentials = System.Net.CredentialCache.DefaultNetworkCredentials;
l_strResult = l_oWebClient.DownloadString(l_strURL);
}
Upvotes: 0
Views: 1946
Reputation: 7197
UPDATE:
Is there any free quota? No, the Google Translate API is only available as a paid service. Please see Pricing and Support for more details. However we do offer the Google Website Translator gadget, which will translate your website without charge.
https://developers.google.com/translate/v2/faq
I get an HTTP 403 error when I call the API. You may be exceeding your quota: either the daily billable total, or the limit on request characters per second. To view or change usage limits for your project, or to request an increase to your total limit, do the following:
Go to the Google Cloud Console. Select a project. In the sidebar on the left, select APIs & auth, then select an API. On the API's info page, select the Quota link near the API name.
Upvotes: 2