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

java - How to specify maven bin in eclipse maven plugin? -

Error while updating a record in APEX screen -

c++ - In an add-in in Excel, written in C(++), how does one get the name of the function which called into the addin? -