public void TestMethod1() { var sms = new SmsMsg91Model() { Country = "7", Route = "1", Sender = "asfdaf", Sms = new List <SMS>() { new SMS(Guid.NewGuid(), new List <string>() { "123456789" }, "asffgsfd") } }; var json = JsonConvert.SerializeObject(sms); }
/// <summary> /// Sends a message to the specified phone number /// </summary> /// <param name="sms"></param> public void SendSms(SMS sms) { var client = new RestClient("http://api.msg91.com/api/v2/sendsms"); var request = new RestRequest(Method.POST); var smsModel = new SmsMsg91Model() { Country = "7", Route = "1", Sender = "senderId", Sms = new List <SMS>() { sms } }; var jsonSms = JsonConvert.SerializeObject(smsModel); request.AddHeader("content-type", "application/json"); request.AddHeader("authkey", ""); request.AddParameter("application/json", jsonSms, ParameterType.RequestBody); IRestResponse response = client.Execute(request); }