首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Yammer API -在Yammer上创建帖子

Yammer API -在Yammer上创建帖子
EN

Stack Overflow用户
提问于 2014-10-09 19:57:10
回答 1查看 5.1K关注 0票数 2

我正在尝试使用Yammer API在Yammer上创建帖子,我有以下代码:

代码语言:javascript
复制
    <!DOCTYPE html>

<html lang="en" xmlns="http://www.w3.org/TR/html5/">
<head>
    <meta charset="utf-8" />
    <title>YammerNotification - Version 1</title>
    <script src="https://assets.yammer.com/platform/yam.js"></script>
    <script>
        yam.config({ appId: "APP-ID" });
    </script>
</head>
<body>
    <button onclick='post()'>Post on Yammer!</button>
    <script>
        function post() {
            yam.getLoginStatus(function (response) {
                if (response.authResponse) {
                    yam.request(
                      {
                          url: "https://www.yammer.com/api/v1/messages.json"
                      , method: "POST"
                      , data: { "body": "This Post was Made Using the Yammer API.  Welcome to the Yammer API World." }
                      , success: function (msg) { alert("{Post was Successful!}: " + msg); }
                      , error: function (msg) { alert("Post was Unsuccessful..." + msg); }
                      }
                    )
                } else {
                    yam.login(function (response) {
                        if (!response.authResponse) {
                            yam.request(
                              {
                                  url: "https://www.yammer.com/api/v1/messages.json"
                              , method: "POST"
                              , data: { "body": "This Post was Made Using the Yammer API.  Welcome to the Yammer API World." }
                              , success: function (msg) { alert("{Post was Successful!}: " + msg); }
                              , error: function (msg) { alert("Post was Unsuccessful..." + msg); }
                              }
                            );
                        }
                    });
                }
            });
        }
    </script>
</body>
</html>

虽然我的应用程序ID是什么?我该如何告诉它我想把帖子放到哪个组呢?

如有任何建议,欢迎光临。

yammer

EN

回答 1

Stack Overflow用户

发布于 2014-10-15 20:03:25

代码语言:javascript
复制
...what would my APP ID be?

您需要按照此处的说明注册一个应用程序- https://developer.yammer.com/introduction/#gs-registerapp,您的应用程序ID是客户端ID的值

代码语言:javascript
复制
And how do I tell it what group I want to put a post to?

在json数据输入中指定groupID:

代码语言:javascript
复制
 data: {
 "body": "This Post was Made Using the Yammer API.  Welcome to the Yammer API World."
 ,"group_id" : groupID
 }

请在此处查看完整的示例代码- http://blogs.technet.com/b/israelo/archive/2014/10/21/yammer-js-sdk-for-dummies.aspx

票数 4
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/26277837

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档