I am playing around alot with the deepl-translation API and I have created a class here called "DeeplRequests: which contains:
private static readonly RestClient Client = new RestClient("https://www2.deepl.com/jsonrpc");
private static readonly RestRequest postRequest = new RestRequest(Method.POST);
private static DeeplAnswer CreateRequest(string text, string sourceLanguage, string targetLanguage)
{
postRequest.Parameters.Clear();
postRequest.AddParameter("auth_key", "<KEY_FROM_ACCOUNT_PAGE");
postRequest.AddParameter("application/json; charset=utf-8", "{}", ParameterType.RequestBody);
postRequest.AddParameter("text", text);
postRequest.AddParameter("source_lang", sourceLanguage);
postRequest.AddParameter("target_lang", targetLanguage);
postRequest.RequestFormat = DataFormat.Json;
var result = Client.Execute(postRequest);
var rawResult = result.Content;
var answer = JsonConvert.DeserializeObject<DeeplAnswer>(rawResult);
return answer;
//DeeplAnswer is a class which has only 3 fields to contain proper JSON responses not big of a deal
}
And I always get 429: TooManyRequests OR when i try this client-url: private static readonly RestClient Client = new RestClient("https://api-free.deepl.com/v2/translate"); with also the proper AUTH_KEY added as a parameter, I always get "403: Forbidden" code??
Does anyone maybe know how to do it properly (note: I am using RestSharp!)#
This would be of a big deal to me to get this work since I want to use it for some higher document translations within our work.
Thanks!