I’ve been playing with the Chatter REST API for a while now. If you haven’t checked out what the Chatter API is, you might want to start with a recent webinar we did covering Social Apps with Chatter and the Chatter API. Whenever I am working with the API, the part that takes the most amount of time is working with the JSON response. Good news is that once you become familiar with the structure, the rest(no pun intended) is pretty straightforward.
I’m going to be presenting at Cloudstock London in a few weeks (did you register already?). One of the things I am going to use heavily during the session is the Apigee Console. Apigee is a great tool for testing REST-based APIs, and it even has built in providers for both the Salesforce REST API, and the Chatter REST API.
Let’s look at an example of using the Apigee Console for newsfeeds. During my session at Cloudstock London I will be covering more examples as well as some tips and tricks to help you build efficient social apps. But for now, back to the console.
The Chatter news feed, like all the other Chatter API resources, is a REST resource. It looks like this: [your salesforce instance. eg: https://na1.salesforce.com/services/data/v24.0/]chatter/feeds/news/[userid or ‘me’/feed-items. We are retrieving our our news feed so the ‘me’ keyword works perfectly. If you have a resource URL that requires inputs such as a feeditem id, the Apigee Console supports this through the Template tab, or if you are are using a resource that supports queries, you can use the Query tab.
Once I am logged in (choose OAuth2 from the Authentication dropdown), I can perform a GET against my resource and see a nicely formatted JSON response returned in the console. Once you have the response, you can start to become familar with the response payload and how you might work with it in your app. For example, the Rails snippet below is from a sample app I wrote a while ago using Rails, JQuery Mobile and the Chatter API, called Rhatter (A combination of Rails and Chatter). The snippet shows how you might retrieve and present the standard Chatter profile information on a mobile app (notice how you handle the phone number pop…cool huh)
If you are interested in learning some more tips and tricks on using the Chatter API, definitely come and check out the Chatter API session at Cloudstock London. Registration is filling up first. To make sure you don’t miss out, sign up now. I hear we have some surprises for developers brewing (stay tuned for more info, but you don’t want to miss out!) And thanks to Apigee for making a great developer tool!