Consuming the Stack Exchange API with C#
- Posted: Oct 19, 2011 at 6:00AM
- 11,581 views
- 2 comments
Loading user information from Channel 9
Something went wrong getting user information from Channel 9
Loading user information from MSDN
Something went wrong getting user information from MSDN
Loading Visual Studio Achievements
Something went wrong getting the Visual Studio Achievements
Need I say anything about the awesome that is Stack Overflow? Okay, maybe adding a walk-through of consuming its API with C# needs to be said...
Two weeks ago I was playing around with the Stack Exchange API to see if it was easy to build a custom flair application. You know, this little guy:
How hard can it be to retrieve a user’s profile, badge count and reputation updates? Surely, Stack Exchange has an API. And they do…and it’s pretty easy to use. Let’s quickly cobble together a small sample application.
- API Usage
- User Profile
- Sending Requests
- Reputation Changes
The post goes into some nice depth; from getting into the API;
You can find the documentation for the Stack Exchange API here:
At the time of writing the latest release is v1.1, but a draft specification for version 2.0 has just been released.
What do you need to know about the API?
- It’s read-only
- All API responses are JSON
- All responses are GZIP’d
- API usage is throttled by IP address
To the tools/libraries you'll need;
So what do we need to be able to use the API?
To writing code...
And in the end, some output;
BTW, to download the full sample, head over to his download page;
So if you're interested in the Stack Overflow/Stack Exchange API, or just consuming a web service API that uses JSON, this project is waiting for you...