I've sent this URL via post:
https://api.instagram.com/v1/users/XXX/relationship?action=unfollow&access_token=YYY
XXX is a valid userid, I've checked that multiple times. The token (YYY) is correct too.
This is the response:
{"meta":{"error_type":"APIInvalidParametersError","code":400,"error_message":"please supply action=approve,ignore,follow,block,unblock,unfollow"}}
I've tried action=follow and action=unfollow. Is it possible, that this is a bug? Where can I report it?
Instagram API Documentation: http://instagram.com/developer/endpoints/relationships/
The problem is that you are not sending the action as postdata. I had the exact problem just yesterday.
The access_token should be sent in the url, but the action=follow should be in the postdata of the request!
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];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With