POST friendships/create fails with code 34, that page does not exist


#1

Hi,

I am having problems with following another user - POST friendships/create.
All my other requests to the twitter API 1.1 succeed except for this one, which returns;
errors = (
{
code = 34;
message = “Sorry, that page does not exist”;
}
);

The code snippit below shows the url I am using - https://api.twitter.com/1.1/friendships/create.json.
The account is valid and has been used to sign all other requests that are made.

    NSMutableDictionary *parameters = [[NSMutableDictionary alloc] init];
    NSURL *url = [NSURL URLWithString:@"https://api.twitter.com/1.1/friendships/create.json"];
    SLRequest *request = [SLRequest requestForServiceType:SLServiceTypeTwitter
                                            requestMethod:SLRequestMethodPOST
                                                      URL:url
                                               parameters:nil];
    
    [parameters setObject:[tagValue stringByReplacingOccurrencesOfString:@"@" withString:@""] forKey:@"screen_name"];
    [parameters setObject:@"true" forKey:@"follow"];
    [request setAccount:self.account];
    [request performRequestWithHandler:^(NSData *responseData, NSHTTPURLResponse *urlResponse, NSError *error) {
        if (responseData != nil) {
            NSError *error = nil;
            NSDictionary *data = [NSJSONSerialization JSONObjectWithData:responseData
                                                                 options:NSJSONReadingMutableLeaves
                                                                   error:&error];
            
            if (error && [data objectForKey:@"errors"]) {
                DLog(@"Error unable to follow user %@ with user info %@.", error, error.userInfo);
            }
        }
    }];

I have also tried using user_id but I am given the same response.

Thanks,

Al Little


#2

Are you sure the screen name or ID you’re sending belongs to an existent user?

Are you possibly sending any cookies along with your request (whether intentionally or implicitly through the HTTP framework) that may be interfering with correctly identifying the context of the request?


#3

I’ve tried quite a few combinations.
screen_name with or without “@” and user_id.

The confusing thing is that I’m making quite a few calls which work;
favourite/unfavorite,
retweet,
search,
lookup.

friendships/create is the only one that fails (the error suggests I have the url wrong).

Apple’s Social library manages the calls and a Wireshark trace doesn’t work as the traffic is encrypted.
All I can tell is that the response from the server is code: 404, page not found.

Thanks for your help.

Al


#4

The horror.

See line 6 where I set up the call before setting the parameters.

All my fault but the error message threw me (404 not found).

Regards,

Al little