5

我已经通过帖子发送了这个 URL:

https://api.instagram.com/v1/users/XXX/relationship?action=unfollow&access_token=YYY

XXX 是一个有效的用户 ID,我已经检查过很多次了。令牌(YYY)也是正确的。

这是回应:

{"meta":{"error_type":"APIInvalidParametersError","code":400,"error_message":"please supply action=approve,ignore,follow,block,unblock,unfollow"}}

我试过 action=follow 和 action=unfollow。有可能,这是一个错误吗?我在哪里可以举报?

Instagram API 文档:http: //instagram.com/developer/endpoints/relationships/

4

3 回答 3

8

问题是您没有将操作作为 postdata 发送。我昨天遇到了确切的问题。

access_token 应该在 url 中发送,但是 action=follow 应该在请求的 postdata 中!

于 2012-04-18T10:50:06.793 回答
1
NSString *initialURL = [NSString stringWithFormat:@"https://api.instagram.com/v1/users/USER_ID/relationship?access_token=ACCESS TOKEN"];
NSURL *url=[NSURL URLWithString:initialURL];

NSString *key = [NSString stringWithFormat:@"action=follow"];
NSData *mastData = [key dataUsingEncoding:NSUTF8StringEncoding allowLossyConversion:YES];
NSString *mastLength = [NSString stringWithFormat:@"%d",[mastData length]];

NSMutableURLRequest *request = [[[NSMutableURLRequest alloc] init] autorelease];
[request setURL:url];
[request setHTTPMethod:@"POST"];
[request setValue:mastLength forHTTPHeaderField:@"Content-Length"];
[request setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"];
[request setHTTPBody:mastData];
NSURLConnection *con=[[NSURLConnection alloc]initWithRequest:request delegate:self];
[con start];
于 2012-04-21T14:17:45.660 回答
0

还要确保在进行身份验证时使用正确的范围。

添加scope=like+comments+relationships该身份验证 URL。

于 2014-01-22T21:04:37.797 回答