Call (Consume) API using RestSharp in ASP.Net

nauna
 
on Jun 03, 2020 08:43 AM
1054 Views

Hello

i have this http code to send sms, how to call it on button click event please advice

var client = new RestClient("https://http-api.d7networks.com/send?username=mmvw6048&password=TPAEZfBB & dlr - method = POST & dlr - url =https://4ba60af1.ngrok.io/receive&dlr=yes&dlr-level=3 &from = smsinfo & content = This is the sample content sent to test &to = 000000000");
var request = new RestRequest(Method.POST);
request.AlwaysMultipartFormData = true;
IRestResponse response = client.Execute(request);

 its gives lots of error.

Download FREE API for Word, Excel and PDF in ASP.Net: Download
dharmendr
 
on Jun 04, 2020 05:31 AM

The code uses RestSharp. Add RestSharp package in your project and import the namespaces.

For code implementation refer below links.

http://restsharp.org/getting-started/#basic-usage

https://visualstudiomagazine.com/articles/2015/10/01/consume-a-webapi.aspx