Posts

Showing posts from August, 2019

Call rest api using RestSharp C#

try {           string postData = "{\"appnsid\": \"TEST12347\",\"pDEode\":\"007\", \"codecr\":\"0031\", \"tnocr\":\"12200243\",\"amount\":\"1\", \"narration\":\"testing using postman\"}" ;          var client = new RestClient( "http://182.13.9.934" );          client.Authenticator = new HttpBasicAuthenticator( "username" , "password" );          var request = new RestRequest( "ums12c/transactionfrom" , Method.POST);          request.AddHeader( "Accept" , "application/json" );          request.AddParameter( "application/json" ,(postData), ParameterType.RequestBody);          IRestResponse response = client.Execute(request);          var content = response.Content;  }  catch(Exception ex){   string value = ex.Message; }