我想使用 java 脚本在我的 g+ 墙上发布/发布一些内容。我可以使用分享按钮。但我的要求是不显示共享弹出窗口,一些内容应该发布在我的墙上。为此,我可以使用时刻插入方法谷歌API。我已经尝试过,我得到了一些回应,但我的墙上没有发布任何内容。这是我的代码请检查。提前致谢。
gapi.client.load('plus', 'v1',function(){
url = "https://developers.google.com/+/plugins/snippet/examples/thing";
var payload = {
"type":"http:\/\/schema.org\/AddAction",
"startDate": "2012-10-31T23:59:59.999Z"
};
if (url != undefined){
payload.target = {
'url' : url
};
}else{
payload.target = {
"id" : "a-special-report-old-foes",
"image" : "http:\/\/www.google.com\/s2\/static\/images\/GoogleyEyes.png",
"description" : "Testing Testing Testing",
"type" : "http:\/\/schema.org\/AddAction",
"name":"An example of AddAction"
};
}
gapi.client.plus.moments.insert(
{ 'userId' : 'me',
'collection' : 'vault',
'resource' : payload
}).execute(function(result){
console.log(result);
});
});
我收到了这个回复
Object {kind: "plus#moment", type: "http://schemas.google.com/AddActivity", target: Object, result: Object, startDate: "2012-10-31T23:59:59.999Z"…}
id: "Eg0xMzUxNzI3OTk5OTk5GJLK-KbPiOfVxgEpCHuQgEQo0AkyAhAUQgcY3ufnoLwG"
kind: "plus#moment"
result: Object
startDate: "2012-10-31T23:59:59.999Z"
target: Object
type: "http://schemas.google.com/AddActivity"
__proto__: Object
最佳答案
时刻不会直接发布到信息流中。正如 https://developers.google.com/+/features/app-activities 上所说:
With a user's permission, individual app activities can appear on their Google+ profile, visible to people they choose to share with...
您的时刻“保管库”会显示在您个人资料的“应用”部分下。单击那里的应用程序将显示已记录的时刻。从这里,用户可以选择将其共享到他们的信息流,但这需要他们采取特定的操作。
没有办法做你想做的事 - Google+ 的设计目的是要求用户明确批准其信息流中显示的任何内容。
关于javascript - 我们可以使用 moment.insert 方法在您的 g+ 墙上发布/发布一些内容吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24991086/