Я пробовал множество конечных точек REST в моем приложении, и все они возвращают доступ. Я смущен этим. Я дважды проверил идентификатор приложения и я знаю, что я получаю авторизовались Вот полный источник:.Все запросы yammer возвращаются Acess Denied
<body>
<button onclick='post()'>Post on Yammer!</button>
<button onclick='loginStatus()'>Login Status</button>
<button onclick='postActivity()'>Post Activity</button>
<button onclick='getSuggestions()'>Get Suggestions</button>
<button onclick='getUser()'>Get User</button>
<button onclick='getMessages()'>Get Messages</button>
<button onclick='search()'>Search</button>`enter code here`
<button onclick='getGroups()'>Groups</button>
<script type="text/javascript">
//<![CDATA[
function post() {
yam.getLoginStatus(function (response) {
if (response.authResponse) {
alert(1);
yam.request({
url: "https://www.yammer.com/api/v1/messages.json",
method: "POST",
data: { "body": "HelloTest" },
success: function (msg) { alert("Post was Successful!: " + msg); },
error: function (msg) { Console.dir(msg);}
});
} else {
alert(2);
yam.login(function (response) {
if (!response.authResponse) {
yam.request({
url: "https://www.yammer.com/api/v1/messages.json",
method: "POST",
data: { "body": "HelloTest" },
success: function (msg) { alert("Post was Successful!: " + msg); },
error: function (msg) { Console.dir(msg); }
});
}
});
}
});
}
function loginStatus() {
yam.getLoginStatus(
function (response) {
if (response.authResponse) {
alert("logged in");
console.dir(response); //print user information to the console
}
else { //authResponse = false if the user is not logged in, or is logged in but hasn't authorized your app yet
alert("logged out");
}
}
);
}
function postActivity() {
yam.request({
url: "https://www.yammer.com/api/v1/activity.json",
method: "POST",
data: {
"activity": {
"actor": {
"name": "Jeff Kirkham",
"email": "[email protected]tailv3dev2.onmicrosoft.com"
},
"action": "create",
"object": {
"url": "https://www.yammer.com/retailv3dev2.onmicrosoft.com",
"title": "Lunch Meeting"
},
"message": "Hey, let’s get sushi!",
"users": [
{
"name": "Jeff Kirkham",
"email": "[email protected]"
}
]
}
},
success: function (msg) { alert("Post was Successful!: " + msg); },
error: function (msg) { console.dir(msg); }
})
}
function getUser() {
yam.request({
url: "https://www.yammer.com/api/v1/users/current.json",
method: "GET",
success: function (msg) { alert("Get was Successful!: " + msg); },
error: function (msg) { console.dir(msg); }
})
}
function getMessages()
{
yam.request({
url: "https://www.yammer.com/api/v1/messages.json",
method: "GET",
success: function (msg) { alert("Get was Successful!: " + msg); },
error: function (msg) { console.dir(msg); }
})
}
function search()
{
yam.request({
url: "https://www.yammer.com/api/v1/search.json",
method: "GET",
search: "Marketing",
success: function (msg) { alert("Get was Successful!: " + msg); },
error: function (msg) { console.dir(msg); }
})
}
function getGroups() {
yam.platform.request({
url: "groups.json?mine=1",
method: "GET",
data: {},
success: function (msg) { alert("Get was Successful!: " + msg); },
error: function (msg) { console.dir(msg); }
})
};
function getSuggestions() {
yam.getLoginStatus(
function (response) {
if (response.authResponse) {
console.log("logged in");
yam.platform.request({
url: "suggestions.json", //this is one of many REST endpoints that are available
method: "GET",
data: { //use the data object literal to specify parameters, as documented in the REST API section of this developer site
"letter": "a",
"page": "2",
},
success: function (user) { //print message response information to the console
alert("The request was successful.");
console.dir(user);
},
error: function (user) {
alert("There was an error with the request.");
console.dir(user);
}
});
}
else {
alert("not logged in")
}
}
);
}
//]]>
</script>
<script data-app-id="gYLlvylCHqAYNiwAa40AHw" src="https://c64.assets-yammer.com/assets/platform_js_sdk.js" type="text/javascript">
</script>
</body>