httprequest - HTTP requests using c# -


i'm rather new sending/receiving on networks/sockets/network streams , on.

i'm making irc program can communicate twitch.tv. have api, , have examples of sorts of requests use different kinds of information.

https://github.com/justintv/twitch-api/tree/master/v3_resources

one example of requests this:

curl -h 'accept: application/vnd.twitchtv.v3+json' \ -x https://api.twitch.tv/kraken/chat/kraken_test_user 

i have tried research on requests, , sort of understand some, part not find resources make click me.

in above example, important parts of request? curl? -h? 1 big command, or 2 commands separated \ @ end of first line?

then, biggest question, how send requests 1 above using c#?

edit 1:

i know getting responses in json. there built in assists receiving/parsing json?

and using put change json? (some things in api allow put).

for first bit of question, asked important parts

  1. it has accept header of application/vnd.twitchtv.v3+json
  2. it get request
  3. the api url: https://api.twitch.tv/kraken/chat/kraken_test_user

this request in c# following (could because there more 1 way it)

private async task<object> getrequest(string url) {     var httpclient = new httpclient();     httpclient.defaultrequestheaders.accept.add(new mediatypewithqualityheadervalue("application/vnd.twitchtv.v3+json"));      var response = await httpclient.getasync(url);     var contents = await response.content.readasstringasync();      return contents; } 

Comments

Popular posts from this blog

javascript - Chart.js (Radar Chart) different scaleLineColor for each scaleLine -

apache - Error with PHP mail(): Multiple or malformed newlines found in additional_header -

java - Android – MapFragment overlay button shadow, just like MyLocation button -