2014-10-09 76 views
2

創建文章中,我嘗試使用Yammer的API來創建的Yammer後, 我有以下代碼: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> 

雖然將我的應用程序ID是什麼?我該如何告訴它我要發佈一個帖子?

任何建議都非常讚賞

哭訴

回答

4
...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