I am trying to use an API and the example they have given is in the form of a Curl command:
curl --location --request POST 'https://dev-api.itranslate.com/translation/v2/' --header 'Authorization: Bearer 603160b7-cee1-4c13-bcd7-37420b55211d' --header 'Content-Type: application/json' --data-raw '{
"source": {"dialect": "en", "text": "Hello World"},
"target": {"dialect": "es"}
}'
I am trying to replicate this using RestSharp. However, in all the examples I can find for RestSharp the parameters are in neat name-value pairs. But in this case the parameters are different, the first one is called "source" and it consists of two further name-value pairs.
I have tried syntax like this:
request.AddHeader("Authorization", "Bearer 603160b7-cee1-4c13-bcd7-37420b55211d");
request.AddParameter("source", "dialect:'en'");
request.AddParameter("source", "Text:'Hello World'");
request.AddParameter("target", "dialect:'es'");
But the server doesn't respond, I assume because it doesn't understand the request. How can I shoehorn these three things ("Source", "Dialect" and "en") into one name-value pair?