Thursday, December 26, 2013

How to call the API Weibo get licensed key post

Example API documentation published a Sina Weibo:

XML
curl-u "username: password"-d 'status = abc & annotations = [{"type2": 123}]' "http://api.t.sina.com.cn/statuses/update.xml?source = appkey "
JSON
curl-u "username: password"-d 'status = abc & annotations = [{"type2": 123}]' "http://api.t.sina.com.cn/statuses/update.json?source = appkey "


But do not know how to use what does this mean ah, oauth_token has been made how to use go ah

There are good-hearted people help you
Reply:
curl is a linux application under support http protocol, if you do not have linux, windows installed cygwin also have curl under this program.
Reply:
In fact, would like to know how to call the API.

Sina Weibo, if there has been some argument, look I am so set on it, some parameters have to get to the
/ / Prepar request
NSString * urlString = [NSString stringWithFormat: @ "http://api.t.sina.com.cn/statuses/update.json?"];
NSMutableURLRequest * request = [[[NSMutableURLRequest alloc] init] autorelease];
[Request setURL: [NSURL URLWithString: urlString]];
[Request setHTTPMethod: @ "POST"];

/ / Create the body
NSString * xmlContents = [[NSString alloc] initWithFormat: @ "oauth_consumer_key =% @ & oauthToken =% @ & oauth_signature_method =% @ & oauth_signature =% @ & oauth_timestamp =% @ & oauth_nonce =% @ & oauth_version = 1.0 & status = sent microblogging content ", oauth_consumer_key, oauthToken, oauth_signature_method, oauth_signature, oauth_timestamp, oauth_nonce];


NSMutableData * postBody = [NSMutableData data];
[PostBody appendData: [xmlContents dataUsingEncoding: NSUTF8StringEncoding]];


/ / Micro-blog post published on request
[Request setHTTPBody: postBody];

Reply:
Sina Weibo have ready objc sdk is available, it is best not to engage in their own

No comments:

Post a Comment