gpt4 book ai didi

javascript - Yammer 开放图 API 错误 400

转载 作者:行者123 更新时间:2023-11-28 01:09:30 26 4
gpt4 key购买 nike

我尝试使用 Open Graph 写入 Yammer 事件源,但收到 400 错误请求错误。我想知道网址或数据是否错误。

function postToActivity() {
yam.getLoginStatus( function(response) {
if (response.authResponse) {
yam.request(
{ url: "https://api.yammer.com/api/v1/activity.json" //note: the endpoint is api.yammer...
, method: "POST"
, data: {
"activity" : {
"actor" : {
"name" : "Ken Domen",
"email" : "ken.domen@nike.com",
"action" : "like",
"object" : {
"url" : "http://www.google.com",
"title" : "Test"
}
}
}
}
, success: function (msg) {
alert("Post was Successful!: " + msg.messages[0].id); //id of new message
}
, error: function (msg) { alert("Post was Unsuccessful..." + msg); }
}
);
} else {
yam.login( function (response) {
//nothing
});
}
});
}

最佳答案

嗯,这对我有用:

创建开放图谱页面:

yam.platform.request({
url: "https://api.yammer.com/api/v1/activity.json",
method: "POST",
data: {
"activity": {
"actor": { "name": "my name", "email": "my email" },
"action": "create",
"object": { "url": "http://google.is", "title": "the page title"},
"type": "url"
}
},
success: function (res) {
alert("The request was successful.");
console.dir(res);
},
error: function (res) {
alert("There was an error with the request.");
console.log(res)
}
})

将消息发布到打开的图表页面:

yam.platform.request({
url: "https://api.yammer.com/api/v1/messages.json",
method: "POST",
data: {
"body" : "Message body",
"group_id": "grup id, i.e. 12345678",
"og_url": "http://google.is"

},
success: function (res) { //print message response information to the console
alert("The request was successful.");
console.dir(res);
},
error: function (res) {
alert("There was an error with the request.");
console.log(res)
}
})

关于javascript - Yammer 开放图 API 错误 400,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24657648/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com