public static class Settings
public static string HostUrl { get { return @"https://geolocwebapi.azurewebsites.net/"; } }
public static string TokenPath { get { return @"Token"; } }
public static string UserInfoPath { get { return @"Account/MobileApplicationUserInfo"; } }
public static string UserBonusOffersPath { get { return @"Account/UserBonus"; } }
public static string ApiUrl { get { return HostUrl + @"api"; } }
public static string RegisterPath { get { return @"Account/Register"; } }
public static string OffersPath { get { return @"Bonus/offersSel"; } }
public static string BonusOffersPath { get { return @"BonusOffer/{longitude}/{latitude}/{radius}"; } }
public static string BonusOfferRequestPath { get { return @"BonusOffer/RequestOffer/{id}"; } }
public static string CafesPath { get { return @"Cafe/{longitude}/{latitude}/{radius}"; } }
public static string GeoLocationPath { get { return @"GeoLocation/{id}"; } }
public double Latitude { get; set; }
public double Longitude { get; set; }
public long Id { get; set; }
public string Label { get; set; }
public string Title { get; set; }
public string Description { get; set; }
public long GroupId { get; set; }
public GeoPoint GeoPoint { get; set; }
public static void Main()
Console.WriteLine("Hello World");
var authData = string.Format("{0}:{1}", @"Test0", @"xx5FsE18");
var authHeaderValue = Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes(authData));
Console.WriteLine(authHeaderValue);
var client = new RestClient(Settings.ApiUrl);
var request = new RestRequest(@"GeoLocation", Method.POST);
request.AddHeader(@"Authorization", string.Format(@"Basic {0}", authHeaderValue));
request.AddBody(new GeoLocation() {
Title = "Гипротрубопровод",
Description = "Акционерное Общество Гипротрубопровод",
GeoPoint = new GeoPoint() { Latitude = 55.70207581, Longitude = 37.57737883 }
var response = client.Execute(request);
if (response.StatusCode == HttpStatusCode.OK)
Console.WriteLine(@"OK: {0}",response.Content);
Console.WriteLine(@"ERROR: {0}",response.Content);