I can not leave comments on Google+

Post (Google+) does not work. I tried to implement the post using the API + Google+ v1 domains ( https://developers.google.com/+/domains/getting-started )

The request is being sent, but GetResponse()I get an error, for example:

The remote server returned an error: (400) Bad request.

I am trying to use the below C # code example that I got from Google+ API plus.me

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));
}

To create new posts and comments, I refer to this URL https://developers.google.com/+/domains/posts/creating . I tried to find a fix for it, however the solution has not yet worked.

+4

Source: https://habr.com/ru/post/1618133/


All Articles