I am new to C# and still try to get familiar with its environment.
I'd like to make a REST-Request in Get-Mode. The guys who gave me the API-Access provided me with following information:
HTTP Methods: GET
Authentication: None
Formats: xml
Parameters: format, apikey [GET], lang [GET], q [GET]
CURL Example: curl --get --data lang="de" --data q="query" --data apikey="QWERTY123456" http://jokr.info/api/v8/search/item.xml
And I don't know how to put this in C#. I tried to use WebClient but I do not know how to put my request with the parameters in action.
There is a popular library RestSharp.
Here is an exemple :
var client = new RestClient("http://example.com");
var request = new RestRequest("api");
request.AddParameter("foo", "bar");
client.ExecuteAsync(request, response => {
// do something with the response
});
Which translates to http://example.com/api?foo=bar
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With