using RestSharp.Authenticators;
using Newtonsoft.Json.Linq;
public static string GetAuthToken(string clientId, string clientSecret) {
var client = new RestClient("https://gateway-kot-dev.digital-ks.net/idp/oauth2/token");
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/x-www-form-urlencoded");
client.Authenticator = new HttpBasicAuthenticator(clientId, clientSecret);
request.AddHeader("Content-Type", "application/x-www-form-urlencoded");
request.AddParameter("grant_type", "client_credentials");
IRestResponse response = client.Execute(request);
JObject result = JObject.Parse(response.Content);
return result["access_token"].Value<string>();
public static string CallCheckSimService(string authToken, string phoneNumber, int activationHours) {
var client = new RestClient("https://gateway-kot-dev.digital-ks.net/mock/api/v1alfa/msisdn/activation-check");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", $"Bearer {authToken}");
request.RequestFormat = DataFormat.Json;
activationHours = activationHours
request.AddJsonBody(data);
IRestResponse response = client.Execute(request);
public static void Main (string[] args) {
var token = GetAuthToken("mock_client_id", "mock_client_secret");
var result = CallCheckSimService(token, "+38 (067) 0000-200", 48);
Console.WriteLine(result);