public static string ApiKey(string siteUrl, string username, string password) { NameValueCollection queryArguments = new NameValueCollection(); queryArguments.Add("SiteUrl", siteUrl); HttpHelper.OverrideAuthenticationCredentials(username, password); string json = HttpHelper.Get("/apikey.json", queryArguments); //reset to default authentication HttpHelper.OverrideAuthenticationCredentials(CreateSendOptions.ApiKey, "x"); return(JavaScriptConvert.DeserializeObject <ApiKeyResult>(json).ApiKey); }