-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
executable file
·42 lines (33 loc) · 1.43 KB
/
Program.cs
File metadata and controls
executable file
·42 lines (33 loc) · 1.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
using System;
using System.IO;
using RestSharp;
namespace MSG91
{
class MainClass
{
public static void Main (string[] args)
{
// generateOTP("91","9999999999","")
//verifyCode ("6375", "91", "9999999999", "");
}
public static void generateOTP(string countryCode, string mobileNumber, string appKey)
{
var client = new RestClient("https://sendotp.msg91.com/api/generateOTP");
var request = new RestRequest(Method.POST);
request.AddHeader("cache-control", "no-cache");
request.AddHeader ("application-key", appKey);
request.AddParameter("undefined", "{\n \"countryCode\": "+countryCode+",\n \"mobileNumber\": "+mobileNumber+",\n \"getGeneratedOTP\": true\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
Console.WriteLine (response.Content);
}
public static void verifyCode( string verificationCode, string countryCode, string mobileNumber,string appKey){
var client = new RestClient("https://sendotp.msg91.com/api/verifyOTP");
var request = new RestRequest(Method.POST);
request.AddHeader("cache-control", "no-cache");
request.AddHeader ("application-key", appKey);
request.AddParameter("undefined", "{\n \"countryCode\": "+countryCode+",\n \"mobileNumber\": "+mobileNumber+",\n \"oneTimePassword\": "+verificationCode+"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
Console.WriteLine (response.Content);
}
}
}