我试图找出如何为Open Graph对象提交有效负载以提交给yammer。我可以发布标准消息,但我想发布一个opengraph消息。
{
"activity":{
"actor":{"name":"Sidd Singh",
"email":"sidd@xyz.com"},
"action":"create",
"object": {
"url":"https://www.sched.do",
"title":"Lunch Meeting"
},
"message":"Hey, let’s get sushi!",
"users":[
{"name":"Adarsh Pandit",
"email":"adarsh@xyz.com"}
]
}
}
这是从他们的API文档中删除的一些代码,但没有告诉我如何在javascript中使用它。有人可以帮我吗?以下是我发布标准邮件的现有代码......
yam.request({
url: "https://www.yammer.com/api/v1/messages.json?network_id=networkname", //this is one of many REST endpoints that are available
method: "POST",
beforeSend: function (req) { //send the access_token in the HTTP header
req.headers.Authorization = "Bearer " + access_token;
},
data: {
"network": "networkname",
"body": "Test Post",
"group_id": "3719771"
},
success: function (data) { //print message response information to the console
toastr.success('An Item was successfully posted to Yammer', "Yammer Network");
},
error: function (user) {
toastr.error('There was an error eith the request', "Yammer Network");
}
});
答案 0 :(得分:0)
这篇文章回答了你的问题:Yammer Open Graph API Error 400
只需使用活动json字符串替换data{}
中的键值对。还要记住将RESTful api端点更改为https://api.yammer.com/api/v1/activity.json