Https://upload.twitter.com/1.1/statuses/update_with_media.json worked fine, now 404 "{"errors":[{"message":"Sorry, that page does not exist","code":34}]"


#1

working on a ios app, using afnetworking, all parts of image upload were working, then today it failed

2013-02-11 17:28:29.314 cramera[3447:907] sending to twitter
2013-02-11 17:28:31.413 cramera[3447:907] Sent 32768 of 104323 bytes
2013-02-11 17:28:31.414 cramera[3447:907] Sent 65536 of 104323 bytes
2013-02-11 17:28:31.414 cramera[3447:907] Sent 98304 of 104323 bytes
2013-02-11 17:28:31.415 cramera[3447:907] Sent 104323 of 104323 bytes
2013-02-11 17:28:31.704 cramera[3447:907] Twitter upload error: Error Domain=AFNetworkingErrorDomain Code=-1011 “Expected status code in (200-299), got 404” UserInfo=0x1f5e3890 {NSLocalizedRecoverySuggestion={“errors”:[{“message”:“Sorry, that page does not exist”,“code”:34}]}, AFNetworkingOperationFailingURLRequestErrorKey=<NSMutableURLRequest https://upload.twitter.com/1.1/statuses/update_with_media.json>, NSErrorFailingURLKey=https://upload.twitter.com/1.1/statuses/update_with_media.json, NSLocalizedDescription=Expected status code in (200-299), got 404, AFNetworkingOperationFailingURLResponseErrorKey=<NSHTTPURLResponse: 0x208c65c0>}

partial code snippet, nothing changed.

            UIImageView *uploadImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 640, 480)];
            UIImage *uploadImage = [image resizedImageToFitInSize:uploadImageView.bounds.size scaleIfSmaller:NO];
            
            NSURL *requestURL = [NSURL URLWithString:@"https://upload.twitter.com/1.1/statuses/update_with_media.json"];
            
            SLRequest *postRequest = [SLRequest
                                      requestForServiceType:SLServiceTypeTwitter
                                      requestMethod:SLRequestMethodPOST
                                      URL:requestURL parameters:nil];
            [postRequest addMultipartData:UIImageJPEGRepresentation(uploadImage, 0.6) withName:@"media[]" type:@"multipart/form-data" filename:nil];
            [postRequest addMultipartData:[status dataUsingEncoding:NSUTF8StringEncoding] withName:@"status" type:@"multipart/form-data" filename:nil];
            [postRequest setAccount:twitterAccount];

#2

In API v1.1, the correct server to use for statuses/update_with_media.json is api.twitter.com. That’s probably why you’re getting the 404.