Getting a List of Chatter Users

The following code example shows a call to return a list of Chatter users.

1// Paste the signed request string into a JavaScript object for easy access.
2var sr = JSON.parse('<%=signedRequestJson%>');
3// Reference the Chatter user's URL from Context.Links object.
4var chatterUsersUrl = sr.context.links.chatterUsersUrl;
5
6// Make an XHR call back to salesforce through the supplied browser proxy. 
7Sfdc.canvas.client.ajax(chatterUsersUrl, 
8    {client : sr.client,
9    success : function(data){
10    // Make sure the status code is OK.
11    if (data.status === 200) {
12        // Alert with how many Chatter users were returned.
13        alert("Got back "  + data.payload.users.length + 
14        " users"); // Returned 2 users
15    }
16}});

See Also