Yammer REST API用于创建具有主题的状态并获取主题Id
Yammer REST API for create status with topic and get back the topic Id
我想使用php和javascript创建yammer状态。这是我的示例代码-
<script type="text/javascript" data-app-id="client-id" src="https://c64.assets-yammer.com/assets/platform_js_sdk.js"></script>
<span id="yammer-login"></span>
<script>
$(function(){
yam.connect.loginButton('#yammer-login', function (resp) {
if (resp.authResponse) {
yam.platform.request({
url: "messages.json",
method: "POST",
data: {
"body" : "Message body",
"group_id": "4728511", //group id
"topic1": "TestTopic1",
"og_url": "http://google.com"
},
success: function (res) { //print message response information to the console
alert("The request was successful.");
console.dir(res);
yam.platform.request({
url: "https://www.yammer.com/api/v1/search.json",
method: "GET",
data: {
"search" : "TestTopic1"
},
success: function (data) { //print message response information to the console
alert("The request was successful.");
console.dir(data);
},
error: function (data) {
alert("There was an error with the request.");
console.log(data)
}
});
},
error: function (res) {
alert("There was an error with the request.");
console.dir(res);
}
});
}
});
状态在yammer上更新,但显示错误,而且我没有得到主题id。那么我该如何纠正。。??
提前感谢
您对search.json的第二次调用似乎是罪魁祸首。当使用JS SDK时,您应该直接调用REST资源,而不是输入URL(如:www.yammer.com或api.yammer.com)。
您已经成功地完成了对messages.json的第一次调用,但应该将第二次调用更新为:
yam.platform.request({
url: "search.json",
method: "GET",
data: {
"search" : "TestTopic1"
},
success: function (data) { //print message response information to the console
alert("The request was successful.");
console.dir(data);
},
error: function (data) {
alert("There was an error with the request.");
console.log(data)
}
});
相关文章:
- 如何将HTML id分配给元素,以及如何将JavaScript应用于元素
- difference between '$(<%= DDL.ID %>) & $('
- 使用Javascript获取所选选项ID
- 事件和状态
- 根据id将json数组组合为一个json数组
- 是否有一个JS/jQuery函数可以获取某个类的每个元素的ID
- 获取选择框的状态
- 相位器状态未捕获参考错误
- 如何更改reactjs中外部/独立组件的状态或属性
- 对id以某个字符串开头的元素进行计数
- 如何使用密码检测网络中的状态连接
- Ember.js-接口状态应该存储在哪里
- 如果元素's的ID以数字开头
- Jquery 选项卡使 url 中的子 ID 选项卡保持打开状态
- Yammer REST API用于创建具有主题的状态并获取主题Id
- 如何摆脱这个{{用户.Id}}(花括号)在页面处于加载状态时使用
- 套接字.Io:检查指定socket id的连接状态
- 如何使用页面重新加载时打开和关闭状态的唯一id修改引导折叠
- 状态为对象数组与id键控的对象
- javascript在两种状态之间更改按钮id-哪种方式最好