I would like to query a dictionary API from my C# method. Here's the specification for what is needed:
POST /DictService/DictService.asmx/DefineInDict HTTP/1.1
Host: services.aonaware.com
Content-Type: application/x-www-form-urlencoded
Content-Length: length
dictId=string&word=string
Here's an example of what is returned but right now I don't get anything returned with my way of doing it using Unrest: http://unirest.io/net.html
HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: length
<?xml version="1.0" encoding="utf-8"?>
<WordDefinition xmlns="http://services.aonaware.com/webservices/">
<Word>string</Word>
<Definitions>
<Definition>
<Word>string</Word>
<Dictionary>
<Id>string</Id>
<Name>string</Name>
</Dictionary>
<WordDefinition>string</WordDefinition>
</Definition>
<Definition>
<Word>string</Word>
<Dictionary>
<Id>string</Id>
<Name>string</Name>
</Dictionary>
<WordDefinition>string</WordDefinition>
</Definition>
</Definitions>
</WordDefinition>
Here's what I tried so far:
HttpResponse<string> jsonResponse = Unirest.post("http://services.aonaware.com/DictService/DictService.asmx/DefineInDict")
.header("Accept", "application/xml")
.header("Content-Type", "application/x-www-form-urlencoded")
.field("dictId", "wn")
.field("word", "abandon")
.asJson<string>();
Always I am getting the error:
406 - Client browser does not accept the MIME type of the requested page.
Can someone help and suggest how I can send this post request. Maybe there's something easier than using Unirest. I am open to any simple C# solution