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


Read More »