Hello,
I want to use OpencelliD API calling in .net code(c#).Is there any sample code to demonstate this.In this api i am trying to get the latitude and longitude values.
Use ReSharp. Is not my best code, but work fine.
static MyAddress RevCellID(int iLac, int iCid)
{
var client = new RestClient(@"https://eu1.unwiredlabs.com/v2/process.php");
var request = new RestRequest(Method.POST);
var myBody = "{\"token\": \"YourTokenHere\",\"radio\": \"gsm\",\"mcc\": 222,\"mnc\": 88,\"cells\": [{\"lac\": 156,\"cid\": 1582}],\"address\": 1}";
request.AddJsonBody(myBody);
var response = client.Execute(request);
var content = response.Content; // Raw content as string
MyAddress NewPoint = new MyAddress();
try
{
JObject rss = JObject.Parse(content);
NewPoint.Address = (string)rss["address"];
NewPoint.Lat = (double)rss["lat"];
NewPoint.Lon = (double)rss["lon"];
}
catch (Exception)
{
}
return NewPoint;
}
public class MyAddress
{
public string Status { get; set; }
public int Balance { get; set; }
public double Lat { get; set; }
public double Lon { get; set; }
public int Accourancy { get; set; }
public string Address { get; set; }
}