This project is read-only.

下载AMicroblog微博WPF版    下载AMicroblogAPI源代码

* What does AMicroblogAPI do?

AMicroBlogAPI is a C# implementation, a strong-typed deep encapsulation, a easy-to-use .net lib of SINA microblog APIs.
App developers no longer need to parse various HTTP responses -- all responses are parsed into strong types;
No longer need to construt the request query strings -- just simply gives the values of parameters;
No longer need to implement the OAuth -- a single call could logs the user on.

A brand new way to access SINA microblog ( for .Net apps

* What is the progress of AMicroblogAPI?

(12/22/2011) AMicroblogAPI 2 is on its way... (targeting OAuth 2)

(11/04/2011) AMicroblog微博WPF版(an application of AMicroblogAPI) is now verified by SINA open platform.

(10/30/2011) AMicroblogAPI v1.0 is now released. Get it now!

(9/25/2011) A web-based ( demo app is now available in AMicroblogAPI SDK.

(9/12/2011) The brand new v2.0 demo app is now available for download. Find out more detail features at AMicroblogAPI official microblog:

(9/7/2011) AMicroblogAPI is now a SINA recommended C# SDK. Follow AMicroblogAPI at


* How to use AMicroblogAPI?

1. Creates your app in and obtains the appKey and appSecret.

2. Configures the appKey and appSecret in application configuation file(i.e: app.config).

<?xml version="1.0"?>
    <add key="appKey" value="12313123"/>
    <add key="appSecret" value="asdasdasdas"/>

3. References AMicroblogAPI dll

Adds AMicroBlogAPI.dll into your project's reference.
(To gain XML serialization performance, make sure AMicroBlogAPI.XmlSerializers.dll is deployed together with AMicroBlogAPI.dll when you release your app)

4. Calls APIs

Before call the APIs, make sure the AccessToken in Environment is well set.

  1. If this is a desktop application, since Environment.AccessToken is set after calling AMicroblog.Login API successfully, no need set it any more (because the value is there once set).
  2. If this is a web application, must set Environment.AccessToken manually before each OAuth-required API call(because web application is stateless). In this case, consider stores the access token in session or somewhere after login.

To call a API, simply calls it like AMicroblog.APIName(parameters)


// Sample code of calling a AMicroblog API
public void Post(string status)
        var updStatusInfo = new UpdateStatusInfo();
        updStatusInfo.Status = status;

        var statusInfo = AMicroblog.PostStatus(updStatusInfo);

        // Further post-process against statusInfo...
    catch (AMicroblogException aex)
        // Handles the exception only if the exception is not handled by Unified Response Error Handling mechanism.
        if (!aex.IsHandled)
            if (aex.IsRemoteError)
                ShowErrorMessage("Server returned an error: {0}", aex.Message);

                // You can customize the error message based on aex.RemoteErrorCode.
                ShowErrorMessage("Unexpected error occured: {0}", aex.Message);
    catch (Exception ex)
        ShowErrorMessage("Unexpected error occured: {0}", ex.Message);                

For more information about response error handling, see Unified Response Error Handling.


  1. Environment.AccessToken is set after calling AMicroblog.Login API successfully.
  2. By default, Environment.AppKey and Environment.AppSecret retrieves the values configured in the application config and are used automatically .
  3. Most APIs have async versions, it can be called like AMicroblog.APINameAsync(callback, parameters)

Demonstration app

A demonstration app is included in AMicroblogAPI project to demonstrate how you can benefit from AMicroblogAPI while building an app from scratch.

API document

All the APIs are with comments. You can look up the details of a particular API from the API document.

The HTTP request hierarchy

(use the http reqeust classes to customize your own API calls)

For issues, please mail to,
or visit AMicroblogAPI microblog at
You are also welcome to visit My Microblog and enjoy.

Last edited Dec 23, 2011 at 1:42 AM by shoocstorm, version 35