Reputation: 3314
I want to make my C# application to be able to send an http request and receive the answer at runtime
an explanation from the website I want to request from is HERE
I don't have any experience with that before, so I'm a little confused about the JSON, XML stuff I know I'll need an XML parser or something like this to understand the request
Upvotes: 11
Views: 26833
Reputation:
Apart from using WebClient as suggested, you could also have a look at EasyHttp by Hadi Hariri from JetBrains. You can find it at https://github.com/hhariri/EasyHttp Summary from ReadMe:
EasyHttp - An easy to use HTTP client that supports:
Upvotes: 6
Reputation: 141994
This http://www.nuget.org/List/Packages/HttpClient is Microsoft's strategic httpclient moving forward. I Expect to see this library implemented across all of Microsoft's platforms in the near future.
Upvotes: 0
Reputation: 14279
You'll want to look up the HttpWebRequest
and HttpWebResponse
objects. These will be the objects that actually make the HTTP requests.
The request and response will contain XML and JSON in the bodies per ViralHeat's API that you linked to.
Upvotes: 3
Reputation: 3383
You could implement a WCF REST API : http://www.codeproject.com/KB/WCF/RestServiceAPI.aspx
Upvotes: 0
Reputation: 437326
Making a HTTP request is very simple if you don't want to customize it: one method call to WebClient.DownloadString
. For example:
var client = new WebClient();
string html = client.DownloadString("http://www.google.com");
Console.WriteLine(html);
You will need to build the correct URL each time as per the documentation you link to.
If you use the example code above to talk to your API, html
(which is really the response data in general) will contain either XML or JSON as a string. You would then need to parse this into some other type of object tree so that you can work with the response.
Upvotes: 20