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!
@JeffBlumenthal - I figured it out, bro. The steps are as following: 1) Make sure you only have ONE deepl-APi-pro account subscribed or the API-free version 2) Make also sure, that you have the right plan for the API to use, consider this text which was put by the deepl-support: "Please note: If you are planning to book a DeepL Pro Starter subscription, the access to API requests is not included. Also, when booking DeepL API or API Free, the access to the DeepL Translate Tool is not included. Those two are separate products, for which you would need an extra account each to book the service." 3) Also make sure to have the right <auth_url> which is:"https://api-free.deepl.com/v2/translate" for FREE-api users and https://api.deepl.com/v2/translate for PRO users. 4) Also make sure to set the auth_key as an AddParameter(...) not as AddHeader(...) for instance: postRequest.AddParameter("auth_key", "1924ea90-12ff-XXXXXXXXXXX"); All those things considered it worked for me , hope you get this done aswell :)=
Cheers!