Hey guys,

Thank you so much for your prompt response!

The URL that I provided came from Twitter+OAUTH sdk that I'm using on
my iPhone App. I was assuming that this library was going to create
the correct URL for me... but it seems that it is generating something
else or could it be that that my library is not updated?

Do you recommend that I modify the Twitter+OAUTH to use an
https://api.twitter.com/1/statuses/user_timeline.json?

I only had this problem with some user timelines, for other timelines
I didnt have this problem. Even when using an URL of type:
https://twitter.com/statuses/user_timeline/justinbieber.json?count=20

The URL that I provided is coming from the following function in
SA_OAuthTwitterEngine.m

- (NSString *)_sendRequestWithMethod:(NSString *)method
                                path:(NSString *)path
                     queryParameters:(NSDictionary *)params
                                body:(NSString *)body
                         requestType:
(MGTwitterRequestType)requestType
                        responseType:
(MGTwitterResponseType)responseType
{
    NSString *fullPath = path;

        NSLog(@"SA_OAuthTwitterEngine - fullPath - pre:%@", fullPath);

        //
--------------------------------------------------------------------------------
        // modification from the base clase
        // the base class appends parameters here
        //
--------------------------------------------------------------------------------
        if(requestType == MGTwitterUserTimelineRequest || requestType ==
MGTwitterUserTimelineForUserRequest || requestType ==
MGTwitterSearchRequest || requestType ==
MGTwitterSearchCurrentTrendsRequest) //added by Carlos to get correct
count of status
        {
                if (params) {
                fullPath = [self _queryStringWithBase:fullPath
parameters:params prefixed:YES];
            }
        }
        //
--------------------------------------------------------------------------------

//copied from MGTwitterEngine.m:465
#if YAJL_AVAILABLE
        NSString *domain = nil;
        NSString *connectionType = nil;
        if (requestType == MGTwitterSearchRequest || requestType ==
MGTwitterSearchCurrentTrendsRequest)
        {
                domain = _searchDomain;
                connectionType = @"http";
        }
        else
        {
                domain = _APIDomain;
                if (_secureConnection)
                {
                        connectionType = @"https";
                }
                else
                {
                        connectionType = @"http";
                }
        }
#else
        NSString *domain = _APIDomain;
        NSString *connectionType = nil;
        if (_secureConnection)
        {
                connectionType = @"https";
        }
        else
        {
                connectionType = @"http";
        }
#endif


        NSLog(@"SA_OAuthTwitterEngine - fullPath - post:%@", fullPath);
        //cchacon: original
    //NSString *urlString = [NSString stringWithFormat:@"%@://%@/%@",
    //                       (_secureConnection) ? @"https" : @"http",
    //                       _APIDomain, fullPath];
        //cchacon: copied from MGTwitterEngine.m:499
        NSString *urlString = [NSString stringWithFormat:@"%@://%@/%@",
                           connectionType,
                           domain, fullPath];

    NSURL *finalURL = [NSURL URLWithString:urlString];
        NSLog(@"SA_OAuthTwitterEngine - finalURL:%@", [finalURL
absoluteString]);
    if (!finalURL) {
        return nil;
    }

        //
--------------------------------------------------------------------------------
        // modificaiton from the base clase
        // the base class creates a regular url request
        // we're going to create an oauth url request
        //
--------------------------------------------------------------------------------
        //    NSMutableURLRequest *theRequest = [NSMutableURLRequest
requestWithURL:finalURL
        //
cachePolicy:NSURLRequestReloadIgnoringCacheData
        //
timeoutInterval:URL_REQUEST_TIMEOUT];
        //
--------------------------------------------------------------------------------

        OAMutableURLRequest *theRequest = [[[OAMutableURLRequest alloc]
initWithURL:finalURL
                                                                                
                                                           
consumer:self.consumer
                                                                                
                                                                  
token:_accessToken
                                                                                
                                                                  realm: nil
                                                                                
                                          signatureProvider:nil] autorelease];
    if (method) {
        [theRequest setHTTPMethod:method];
    }
    [theRequest setHTTPShouldHandleCookies:NO];

    // Set headers for client information, for tracking purposes at
Twitter.
    [theRequest setValue:_clientName    forHTTPHeaderField:@"X-Twitter-
Client"];
    [theRequest setValue:_clientVersion forHTTPHeaderField:@"X-Twitter-
Client-Version"];
    [theRequest setValue:_clientURL     forHTTPHeaderField:@"X-Twitter-
Client-URL"];

    // Set the request body if this is a POST request.
    BOOL isPOST = (method && [method isEqualToString:@"POST"]);
    if (isPOST) {
        // Set request body, if specified (hopefully so), with
'source' parameter if appropriate.
        NSString *finalBody = @"";
                if (body) {
                        finalBody = [finalBody stringByAppendingString:body];
                }
        if (_clientSourceToken) {
            finalBody = [finalBody stringByAppendingString:[NSString
stringWithFormat:@"%...@source=%@",
                                                            (body) ?
@"&" : @"?" ,
 
_clientSourceToken]];
        }

        if (finalBody) {
            [theRequest setHTTPBody:[finalBody
dataUsingEncoding:NSUTF8StringEncoding]];
        }
    }

        //
--------------------------------------------------------------------------------
        // modificaiton from the base clase
        // our version "prepares" the oauth url request
        //
--------------------------------------------------------------------------------
        [theRequest prepare];

    // Create a connection using this request, with the default
timeout and caching policy,
    // and appropriate Twitter request and response types for parsing
and error reporting.
    MGTwitterHTTPURLConnection *connection;
    connection = [[MGTwitterHTTPURLConnection alloc]
initWithRequest:theRequest
 
delegate:self
 
requestType:requestType
 
responseType:responseType];

    if (!connection) {
        return nil;
    } else {
        [_connections setObject:connection forKey:[connection
identifier]];
        [connection release];
    }

    return [connection identifier];
}



Thanks,
Carlos



On Oct 16, 1:53 pm, Matt Harris <mhar...@twitter.com> wrote:
> In addition make sure you add the parameter include_rts=1 to the request.
>
> The include_rts flag instructs the API to include retweets in the response. 
> Looking at the timeline you requested it looks as if the last 20 Tweets by 
> that user are retweets - which, by default, are not included in the timeline 
> but are included in the count.
>
> Best,
> Matt
>
> On Oct 16, 2010, at 12:24, Taylor Singletary <taylorsinglet...@twitter.com> 
> wrote:
>
>
>
> > It should be pointed out that those aren't valid API URLs..
>
> > You want to execute these requests against API.twitter.com/1/resource...
>
> > The best way to construct your URL would be like this: (it reduces 
> > ambiguity)
>
> >https://api.twitter.com/1/statuses/user_timeline.json?screen_name=jus...
>
> > Finally, we are having some strange issues with certain timelines. If 
> > you're running into this, it means the timeline is being a bit erratic. Try 
> > requesting a higher count, like 100. We are looking into this behavior and 
> > hope to fix it soon.
>
> > Taylor
>
> > On Sat, Oct 16, 2010 at 2:35 AM, CarlosChacon <aigoosoftw...@gmail.com> 
> > wrote:
> > I'm trying to access justinbieber timeline but its returning "[]"...
> > I'm using this URL:
> >https://twitter.com/statuses/user_timeline/justinbieber.json?count=20
>
> > If I try the timeline for other users it works fine. for example:
> >https://twitter.com/statuses/user_timeline/cnn.json?count=20
>
> > Any idea why this is happening?
>
> > If I go tohttp://twitter.com/justinbieberit seems to be okay, but
> > when 
> > usinghttps://twitter.com/statuses/user_timeline/justinbieber.json?count=20
> > it keeps returning an empty array...
>
> > --
> > Twitter developer documentation and resources:http://dev.twitter.com/doc
> > API updates via Twitter:http://twitter.com/twitterapi
> > Issues/Enhancements Tracker:http://code.google.com/p/twitter-api/issues/list
> > Change your membership to this 
> > group:http://groups.google.com/group/twitter-development-talk
>
> > --
> > Twitter developer documentation and resources:http://dev.twitter.com/doc
> > API updates via Twitter:http://twitter.com/twitterapi
> > Issues/Enhancements Tracker:http://code.google.com/p/twitter-api/issues/list
> > Change your membership to this 
> > group:http://groups.google.com/group/twitter-development-talk

-- 
Twitter developer documentation and resources: http://dev.twitter.com/doc
API updates via Twitter: http://twitter.com/twitterapi
Issues/Enhancements Tracker: http://code.google.com/p/twitter-api/issues/list
Change your membership to this group: 
http://groups.google.com/group/twitter-development-talk

Reply via email to