【问题标题】:Yammer API - Creating a post on YammerYammer API - 在 Yammer 上创建帖子
【发布时间】:2015-01-14 00:14:57
【问题描述】:

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

    <!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>

虽然我的 APP ID 是什么?以及如何告诉它我想向哪个群组发帖?

非常感谢任何建议

yammer

【问题讨论】:

    标签: yammer


    【解决方案1】:
    ...what would my APP ID be?
    

    您需要按照此处记录的方式注册一个应用程序 - https://developer.yammer.com/introduction/#gs-registerapp 并且您的 APP ID 是客户端 ID 的值

    And how do I tell it what group I want to put a post to?
    

    在您的 json 数据输入中指定 groupID:

     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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-06-11
      • 2020-11-16
      • 1970-01-01
      • 2018-07-31
      • 1970-01-01
      • 2014-09-13
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多