Skip to content

Instantly share code, notes, and snippets.

@iogbole
Created December 4, 2014 12:06
Show Gist options
  • Save iogbole/1700f0fc4db3a3559723 to your computer and use it in GitHub Desktop.
Save iogbole/1700f0fc4db3a3559723 to your computer and use it in GitHub Desktop.
Search API test
<html>
<head>
<script type="text/javascript" data-app-id="INSERT-Your-ID" src="https://assets.yammer.com/assets/platform_js_sdk.js"></script>
<script>
function SearchForIsrael() {
yam.getLoginStatus(
function(response) {
if (response.authResponse) {
console.log("logged in");
yam.platform.request({
url: "https://api.yammer.com/api/v1/search.json",
method: "GET",
data: {
"search": "Israel",
"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.");
}
});
}
else {
alert("not logged in")
yam.login( function (response) {
if (!response.authResponse) {
}
});
}
}
);
}
</script>
</head>
<body>
<button onclick='SearchForIsrael()'>Get Current User</button>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment