Posting a jaiku using xcode
NSMutableURLRequest *jaikuRequest=[NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"http://api.jaiku.com/json"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:60.0];
[jaikuRequest setHTTPMethod:@"POST"];
NSString *jbody= [NSString stringWithFormat:@"method=presence.send&user=XXusernameXX&personal_key=XXpersonalkeyXX&message=%@",
encode开发者_高级运维dMsg];
[jaikuRequest setHTTPBody:[[NSString stringWithFormat:jbody] dataUsingEncoding:NSASCIIStringEncoding]];
I wrote the above code snippet to be able to post a jaiku on jaiku.com. I've come across similar samples in other languages for posting a jaiku. However i get the following response in the console:
{"status": "error", "message": "Invalid API user", "code": 0}
what could be the error or if im wrong, what is the correct approach to posting a jaiku using xcode?
You are trying to use the legacy authentication which is deprecated and sounds like it might not be fully functional any longer (certainly untested):
http://www.jaiku.com/api/docs/authentication
You should try using the new OAuth authentication they document at the above link. definitely more complicated (and secure).
精彩评论