android - post json as httpcontent to webapi -


i have webapi want post json , return json. im using xamarin create android app doesn't seem support postasjsonasync method httpclient. im trying postasync method post httpcontent. want convert json of format httpcontent , json can post webapi. code:

        var clientrequest = new resourcebynamerequest         {             name = "g60",             userid = "1"         };       var param = jsonconvert.serializeobject(clientrequest);         httpcontent content = new stringcontent(param, encoding.utf8, "application/json");              var client = new httpclient();             var cancellationtoken = new cancellationtoken();             var result = client.postasync("https://mctwebapi-test.entrematic.com/api/resource/resourcebyname?", content, cancellationtoken).result;             return reslist; 

this runs till timeout. can't figure out why doesn't work. if have other suggestions on how post json webapi using xamarin im more happy try out! plz help!


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -