In this post I would like to go through some of the endpoints in the Yammer REST API handling user profiles in a network.

You can generate the baerer token (access token) as described in this post.

Always consider the REST API and Rate Limits when accessing a Yammer network.

Retrieve the users in a network

The snippet presented in this section is retrieving the list of users in a network. By default the list returns batches of 50 users. You can find other parameters under the official documentation. The default sorting is alphabetically, but you might want to sort by messages or followers with the sort_by query string. If you have more than 50 users, you might want to use the the page parameter to get different batches.

Check my blogpost to see how to get all users with a PowerShell commandlet here.

Retrieve a user by ID

The next snippet shows how to retrieve a single user by id instead of accessing it through the whole network.

Retrieve a user by email

Retrieving a user by ID might not always be the option for you. Therefore, Yammer also provides you an endpoint to get the user by e-mail address.

Create a new user

With the snippet below you are going to create a user profile for a specific user. The service will return a StatusCode 201 if successful. If a user already exist in the network, you will get back a 400 bad request.

Delete a user by ID

The snippet below shows how to delete a user by ID. By specifying the delete=true parameter in the url, you are going to permanently delete the user. Otherwise, the user is just going to be suspended.

comments powered by Disqus