Google Analytics - Webclient UploadValues返回404,但网址在浏览器

时间:2017-12-22 21:05:38

标签: c# google-analytics webclient google-analytics-api

我正在尝试在此帖子后面调用Google AnalyticsAPI: Google Analytics API - Programmatically fetch page views in server side

到目前为止,这是我的代码:

WebClient webClient = new WebClient();
NameValueCollection data = new NameValueCollection();
data.Add("accountType", "GOOGLE");
data.Add("Email", "email@company.com");
data.Add("Passwd", "password!");//Passwd, not a misspell.
data.Add("service", "analytics");

byte[] bytes = webClient.UploadValues(new Uri("https://www.google.com/accounts/ClientLogin"), "POST", data);
string tokens = Encoding.UTF8.GetString(bytes);
string authToken = extractAuthToken(tokens);

但是,我在webClient.UploadValues上收到错误:远程服务器返回错误:(404)Not Found。

1 个答案:

答案 0 :(得分:0)