Pages

Wednesday, May 16, 2012

Yammer API Call from Dot Net C#

Simple steps to get Yammer API working

Before writing any code, we should get a permanent token to access the Yammer API. 

Please follow these steps to get permanent access token:

1. Click this link > https://developer.yammer.com/api/sandbox.html
2. Click the "get a new token" link.
3. Plug in the Client Key and Client Secret key.
4. Click "get verifier url".
5. Click the Yammer oauth link that is created.
6. Verify which network you want the application to have access to.
7. You should be given a code with 4 characters.
8. Copy and paste the code back in the "verifier" field on the same page referenced in step 1. Click "get permanent token"
9. A token will be produced in the Token field. This is your Access Token that will be used in your script.

Once you get the token, use it in a below C# code:

HttpWebRequest req = WebRequest.Create("https://www.yammer.com/api/v1/users/by_email.json?email=youremail@yourcompany.com&access_token=your_permanenet_access_token") as HttpWebRequest;
using (HttpWebResponse res = req.GetResponse() as HttpWebResponse)
{
StreamReader read = new StreamReader(res.GetResponseStream());
Response.Write(read.ReadToEnd());
}

You will be good to go.

Note: This is just an example to get you started.
View Sunny Bahree's profile on LinkedIn


9 comments:

  1. Thanks for your post.
    I am trying to develop a windows app. Is it possible to get a token, authorize application

    ReplyDelete
  2. Yes, you can get the token but you should be Yammer admin I believe.

    ReplyDelete
  3. hi

    i need to post messages into a yammer group and retrieve a thread by id and its comments. is it possible?
    can you refer me to sample code if there is oe?

    ReplyDelete
  4. There are five basic divisions of the dot net services including net framework 1.1, net framework 2.0, net framework 3.0, net framework 3.5 and net framework 4.0. This framework offers the most reliable and accurate web applications that are frequently monitored by the web server.

    .Net Application Development

    Dot Net Development

    ReplyDelete
  5. Article web beaucop sypa sur lla cuisine du monde.
    J'aime moi-même les différences culinaires entre tous
    lles pays.

    ReplyDelete
  6. Microsoft offer .NET platform for developer to create applications and softwares. software development in .NET is more secure and reliable than others such type of platforms.

    ReplyDelete
  7. {"The remote server returned an error: (401) Unauthorized."} I am getting this exception.

    ReplyDelete
    Replies
    1. Things have change a lot since I have published this article.

      There are few new things in place from Yammer side to connect to its APIs.

      Please see this URL for more information on how the things works now with respect to Yammer and its APIs - https://developer.yammer.com/docs/getting-started,

      Delete