我无法在Google+中发表任何评论

时间:2015-12-01 15:19:12

标签: c# google-api google-plus

发布(Google+)无效。 我尝试使用Google+域名API v1(https://developers.google.com/+/domains/getting-started

来实施帖子

发送请求有效,但GetResponse(),我收到如下错误:

  

远程服务器返回错误:(400)错误请求。

我正在尝试使用以下来自Google+ API plus.me

的示例C#代码
var url = "https://www.googleapis.com/plusDomains/v1/people/me/activities?";
var googleParameters = AppendKeyvalue("access_token", access_token) + AppendKeyvalue("message", message);
var fullurl = url + googleParameters;

HttpWebRequest request= (HttpWebRequest)HttpWebRequest.Create(fullurl);
request.ContentType = " application/x-www-form-urlencoded ";
request.Method = "POST";
UTF32Encoding utfenc = new UTF32Encoding();

byte[] byteArray = utfenc.GetBytes(fullurl);
Stream postStream = request.GetRequestStream();
postStream.Write(byteArray, 0, byteArray.Length);
postStream.Close();
WebResponse response = request.GetResponse();

public static string AppendKeyvalue(string key, string value)
{
    return string.Format("{0}={1}&", HttpUtility.UrlEncode(key), HttpUtility.UrlEncode(value));
}

要创建新帖子和评论,我引用此网址https://developers.google.com/+/domains/posts/creating。 我试图弄清楚它的解决方案,但到目前为止解决方案还没有奏效。

0 个答案:

没有答案