[twitter-dev] Re: Retrieve tweets with ID greater than a passed-in ID?

2009-03-11 Thread Nick Toumpelis


Hi Greg,

I sent an email about this about a week ago because I thought that  
since_id should return all the tweets after the given ID. Apparently,   
(thanks to Matt Sanford) you also need the count parameter in the call.


As far as I can tell, your call is to the API is otherwise OK.

Hope that helps,

Nick


On 11 Μαρ 2009, at 1:39 ΠΜ, Greg Maletic wrote:



Thanks, Josh. That gives me some valuable insight into what's needed
behind the scenes. I think, however, I'm going to try out
MGTwitterEngine, as it's a full-featured framework that'll save me
from having to figure this whole thing out.

Thanks for everyone's help! Much appreciated.

--Greg


Nick Toumpelis

email: n...@toumpelis.me.uk
twitter: macsphere











[twitter-dev] Re: Retrieve tweets with ID greater than a passed-in ID?

2009-03-10 Thread Greg Maletic

Thanks, Josh. That gives me some valuable insight into what's needed
behind the scenes. I think, however, I'm going to try out
MGTwitterEngine, as it's a full-featured framework that'll save me
from having to figure this whole thing out.

Thanks for everyone's help! Much appreciated.

--Greg


[twitter-dev] Re: Retrieve tweets with ID greater than a passed-in ID?

2009-03-10 Thread Joshua Perry

Greg,

It looks like the code (in jetchJSONObjectForURL) is using a shortcut 
method of grabbing data from the web with 
NSString:initWithContentsOfURL: which creates an NSString from the 
contents at a specific URL ( go figure! ).  I'm not sure if that method 
utilizes the credential store, if not you would need to expand the code 
to get the data explicitly with a NSURLConnection (Like is done in the 
updateStatus function)

You can register a set of credentials with the credential storage system 
before you make the NSURLConnection call like so:

NSURLCredential *credential =
  [NSURLCredential credentialWithUser:username
 password:password
  persistence:NSURLCredentialPersistenceForSession];

NSURLProtectionSpace *protectionSpace =
  [[NSURLProtectionSpace alloc] initWithHost:@"twitter.com"
port:0
protocol:@"http"
   realm:nil
authenticationMethod:nil];


[[NSURLCredentialStorage sharedCredentialStorage] 
setDefaultCredential:credential

forProtectionSpace:protectionSpace];

Now that the credentials are stored you are free to make your call using 
NSURLConnection (verbatim from your code):
NSData *data = [NSURLConnection sendSynchronousRequest:request 
returningResponse:&response error:&error];


Also, change this line:

NSURL *url = [NSURL URLWithString:[NSString 
stringWithFormat:@"http://%@:%@@twitter.com/statuses/update.json";, 
username, password]];

to this:

NSURL *url = [NSURL 
URLWithString:@"http://twitter.com/statuses/update.json";];

Josh

Doug Williams wrote:
> Guys, this is a little out of my realm of expertise. Any Objective-C
> folks out there able to lend Greg a hand?
>
> Greg, if no one responds soon, I'll roll my sleeves up and play around
> with the source...
>
> Doug Williams
> Twitter API Support
> http://twitter.com/dougw
>
>
>
> On Tue, Mar 10, 2009 at 3:04 PM, Greg Maletic  wrote:
>   
>> On Mar 10, 6:54 am, Doug Williams  wrote:
>> 
>>> Can you tell me which library you are using?
>>>   
>> It's just a basic library that was given as part of a class at
>> Stanford on iPhone development. If you want to download the source, it
>> can be downloaded from 
>> http://www.stanford.edu/class/cs193p/cgi-bin/index.php;
>> download the file called Presence4Files.zip.
>>
>>
>> 
>>> Also, can you include sample code of the request you are making (obscure 
>>> your credentials of course)?
>>>   
>> The request made by the Objective-C method I'm calling is:
>>
>>   
>> http://[username]:[passwo...@twitter.com/statuses/user_timeline/[username].json?since_id=[id]
>>
>> If I leave off the since_id, it works as expected. When I specify the
>> since_id, it still works, but it doesn't honor the since_id in any
>> way.
>>
>> Thanks very much,
>>
>> Greg
>>
>> 


[twitter-dev] Re: Retrieve tweets with ID greater than a passed-in ID?

2009-03-10 Thread Alex Payne

You might look at what MGTwitterEngine does:
http://svn.cocoasourcecode.com/MGTwitterEngine/

On Tue, Mar 10, 2009 at 14:03, Doug Williams  wrote:
>
> Guys, this is a little out of my realm of expertise. Any Objective-C
> folks out there able to lend Greg a hand?
>
> Greg, if no one responds soon, I'll roll my sleeves up and play around
> with the source...
>
> Doug Williams
> Twitter API Support
> http://twitter.com/dougw
>
>
>
> On Tue, Mar 10, 2009 at 3:04 PM, Greg Maletic  wrote:
>>
>> On Mar 10, 6:54 am, Doug Williams  wrote:
>>> Can you tell me which library you are using?
>>
>> It's just a basic library that was given as part of a class at
>> Stanford on iPhone development. If you want to download the source, it
>> can be downloaded from 
>> http://www.stanford.edu/class/cs193p/cgi-bin/index.php;
>> download the file called Presence4Files.zip.
>>
>>
>>> Also, can you include sample code of the request you are making (obscure 
>>> your credentials of course)?
>>
>> The request made by the Objective-C method I'm calling is:
>>
>>   
>> http://[username]:[passwo...@twitter.com/statuses/user_timeline/[username].json?since_id=[id]
>>
>> If I leave off the since_id, it works as expected. When I specify the
>> since_id, it still works, but it doesn't honor the since_id in any
>> way.
>>
>> Thanks very much,
>>
>> Greg
>>
>



-- 
Alex Payne - API Lead, Twitter, Inc.
http://twitter.com/al3x


[twitter-dev] Re: Retrieve tweets with ID greater than a passed-in ID?

2009-03-10 Thread Doug Williams

Guys, this is a little out of my realm of expertise. Any Objective-C
folks out there able to lend Greg a hand?

Greg, if no one responds soon, I'll roll my sleeves up and play around
with the source...

Doug Williams
Twitter API Support
http://twitter.com/dougw



On Tue, Mar 10, 2009 at 3:04 PM, Greg Maletic  wrote:
>
> On Mar 10, 6:54 am, Doug Williams  wrote:
>> Can you tell me which library you are using?
>
> It's just a basic library that was given as part of a class at
> Stanford on iPhone development. If you want to download the source, it
> can be downloaded from http://www.stanford.edu/class/cs193p/cgi-bin/index.php;
> download the file called Presence4Files.zip.
>
>
>> Also, can you include sample code of the request you are making (obscure 
>> your credentials of course)?
>
> The request made by the Objective-C method I'm calling is:
>
>   
> http://[username]:[passwo...@twitter.com/statuses/user_timeline/[username].json?since_id=[id]
>
> If I leave off the since_id, it works as expected. When I specify the
> since_id, it still works, but it doesn't honor the since_id in any
> way.
>
> Thanks very much,
>
> Greg
>


[twitter-dev] Re: Retrieve tweets with ID greater than a passed-in ID?

2009-03-10 Thread Greg Maletic

On Mar 10, 6:54 am, Doug Williams  wrote:
> Can you tell me which library you are using?

It's just a basic library that was given as part of a class at
Stanford on iPhone development. If you want to download the source, it
can be downloaded from http://www.stanford.edu/class/cs193p/cgi-bin/index.php;
download the file called Presence4Files.zip.


> Also, can you include sample code of the request you are making (obscure your 
> credentials of course)?

The request made by the Objective-C method I'm calling is:

   
http://[username]:[passwo...@twitter.com/statuses/user_timeline/[username].json?since_id=[id]

If I leave off the since_id, it works as expected. When I specify the
since_id, it still works, but it doesn't honor the since_id in any
way.

Thanks very much,

Greg


[twitter-dev] Re: Retrieve tweets with ID greater than a passed-in ID?

2009-03-10 Thread Doug Williams

Greg,
I'm not an Objective-C student but I'll do what I can. Can you tell me
which library you are using? Also, can you include sample code of the
request you are making (obscure your credentials of course)?

Thanks,
Doug Williams
Twitter API Support
http://twitter.com/dougw



On Tue, Mar 10, 2009 at 1:00 AM, Greg Maletic  wrote:
>
> Hi, Doug--
>
> Can you explain what you mean that credentials need to be "pushed
> through the header?" I'm using an Objective-C library I found to
> access Twitter, and the method I outlined is what this library is
> doing to access password-protected accounts. If I can get some clarity
> on what you mean, I might be able to rewrite some of their code to use
> your technique instead.
>
> Thanks very much,
>
> Greg
>


[twitter-dev] Re: Retrieve tweets with ID greater than a passed-in ID?

2009-03-10 Thread Greg Maletic

Hi, Doug--

Can you explain what you mean that credentials need to be "pushed
through the header?" I'm using an Objective-C library I found to
access Twitter, and the method I outlined is what this library is
doing to access password-protected accounts. If I can get some clarity
on what you mean, I might be able to rewrite some of their code to use
your technique instead.

Thanks very much,

Greg


[twitter-dev] Re: Retrieve tweets with ID greater than a passed-in ID?

2009-03-09 Thread Doug Williams
Greg,
If you want to access a user_timeline through a browser try sending a
request to:

http://twitter.com/statuses/user_timeline/[username].json
?since_id=[since_id]

where the variables denoted with [*] are replaced accordingly. You will be
prompted to input your username and password for basic authentication.

You can also try the same call through a command line with cURL:

curl -u username:password
http://twitter.com/statuses/user_timeline/[username].json?since_id=[since_id]

Does that set you on the right path? I believe what is tripping you up is
placing the credentials in the URL when they need to be pushed through the
headers.

Doug Williams
Twitter API Developer Support
http://twitter.com/dougw


On Mon, Mar 9, 2009 at 2:14 PM, Cameron Kaiser  wrote:

>
> > A question that I haven't been able to figure out by reading the
> > documentation...
> >
> > I'm currently using the JSON call:
> >
> > http://[username]:[password]@
> twitter.com/statuses/user_timeline/[username].json
> >
> > ...to retrieve tweets from a password-protected Twitter account. How
> > can I modify this call (or use some other call entirely) so that I
> > only retrieve tweets with an ID greater than a certain number? (I've
> > tried tacking on ?since_id=[id] to the URL, but that doesn't seem to
> > work.)
>
> since_id is in fact exactly what you would use. Can you give us an example
> of your code and output?
>
> --
>  personal:
> http://www.cameronkaiser.com/ --
>  Cameron Kaiser * Floodgap Systems * www.floodgap.com *
> ckai...@floodgap.com
> -- Famous, adj.: Conspicuously miserable.  -- Ambrose Bierce
> --
>


[twitter-dev] Re: Retrieve tweets with ID greater than a passed-in ID?

2009-03-09 Thread Cameron Kaiser

> A question that I haven't been able to figure out by reading the
> documentation...
> 
> I'm currently using the JSON call:
> 
> http://[username]:[passwo...@twitter.com/statuses/user_timeline/[username].json
> 
> ...to retrieve tweets from a password-protected Twitter account. How
> can I modify this call (or use some other call entirely) so that I
> only retrieve tweets with an ID greater than a certain number? (I've
> tried tacking on ?since_id=[id] to the URL, but that doesn't seem to
> work.)

since_id is in fact exactly what you would use. Can you give us an example
of your code and output?

-- 
 personal: http://www.cameronkaiser.com/ --
  Cameron Kaiser * Floodgap Systems * www.floodgap.com * ckai...@floodgap.com
-- Famous, adj.: Conspicuously miserable.  -- Ambrose Bierce --