Answer the question
In order to leave comments, you need to log in
Am I passing the wrong header in a POST request (C#)?
There is a translator API
https://rapidapi.com/jenio-inc-jenio-inc-default/a...
It has the following example of a POST request to RestSharp (a valid key is nested):
var client = new RestClient("https://kiara-translate.p.rapidapi.com/get_translated/");
var request = new RestRequest(Method.POST);
request.AddHeader("x-rapidapi-host", "kiara-translate.p.rapidapi.com");
request.AddHeader("x-rapidapi-key", "tb0d24d7fffmsh9be6b811c6b83dcp131c79jsn83b8a400788b");
request.AddHeader("content-type", "application/json");
request.AddHeader("accept", "application/json");
request.AddParameter("application/json", "{ "input": "We make the world a better place", "lang": "ja"}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
request.AddParameter("application/json", "{ "input": "We make the world a better place", "lang": "ja"}", ParameterType.RequestBody);
Specified value has invalid HTTP Header characters
"produces a syntax error.
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question