API access to your own timeline

4 views
Skip to first unread message

jesse newland

unread,
Mar 10, 2007, 6:23:03 PM3/10/07
to Twitter Development Talk
Would it be possible to provide API access to the timeline of the
logged in user?

Currently, to access the status one specific user in user, you must:

a) not protect your updates
b) know your own user id# (easily discoverable, but not friendly)

I'm currently getting at my own status this way:

-----

require 'rubygems'
require 'open-uri'
require 'json'
require 'fileutils'

userid = XXXXX

twitter_json_url = "http://www.twitter.com/t/status/user_timeline/
#{userid}?count=1"

status = JSON.parse(open(twitter_json_url){|fd|
fd.read}).first["text"]

puts status

----

Thoughts?

Jesse

Alex Payne

unread,
Mar 10, 2007, 6:53:28 PM3/10/07
to twitter-deve...@googlegroups.com
Jesse,

This is absolutely possible, and yours is not the first request we've
heard for it. We'll start doing timelines by username so you don't
have to find your user id.

As for being unprotected, well, that's something I don't think we can
provide a short-circuit for. If you want a protected user's updates,
you have to authenticate to verify your access to those updates.

--
Alex Payne
Obvious
http://twitter.com/al3x

jesse newland

unread,
Mar 10, 2007, 10:25:28 PM3/10/07
to Twitter Development Talk
Alex -

That's great! However, providing the status updates by username still
requires additional information - I'm hoping to get at this data, like
the rest of the twitter API, after authenticating with my email &
pass.

How about this:

http://twitter.com/statuses/timeline.(json|xml)

Requires Basic Auth, and returns the timeline of the logged in user.

This will allow protected users to still be protected, and not require
any additional info (username/userID) once authenticated to get at
ones own statuses. Possible?

Thanks! Have fun at SXSW - I'm missing it terribly.

Jesse

On Mar 10, 6:53 pm, Alex Payne <a...@al3x.net> wrote:
> Jesse,
>
> This is absolutely possible, and yours is not the first request we've
> heard for it. We'll start doing timelines by username so you don't
> have to find your user id.
>
> As for being unprotected, well, that's something I don't think we can
> provide a short-circuit for. If you want a protected user's updates,
> you have to authenticate to verify your access to those updates.
>
> --
> Alex Payne

> Obvioushttp://twitter.com/al3x

Blaine Cook

unread,
Mar 10, 2007, 11:27:45 PM3/10/07
to twitter-deve...@googlegroups.com
Hey Jesse,

the method you provided will work as written;

curl -u username http://twitter.com/statuses/friends_timeline.json
curl -u username http://twitter.com/statuses/user_timeline.json

will both return the timeline for the user specified by username.

--
Blaine ( http://twitter.com/blaine )

jesse newland

unread,
Mar 10, 2007, 11:43:35 PM3/10/07
to Twitter Development Talk
Blaine -

> curl -u usernamehttp://twitter.com/statuses/friends_timeline.json
This works fine.

This 404s. However, it's *exactly what I'm looking for.

Jesse
http://twitter.com/jnewland

Blaine Cook

unread,
Mar 11, 2007, 12:32:08 AM3/11/07
to twitter-deve...@googlegroups.com
Ahh, you're right. Fixed, and deploying now.

b.

On 3/10/07, jesse newland <jnew...@gmail.com> wrote:
>

jesse newland

unread,
Mar 11, 2007, 10:14:16 AM3/11/07
to Twitter Development Talk
Thanks for working on this for me! However, I'm still seeing a 404:

$ curl -u jnew...@gmail.com http://twitter.com/statuses/user_timeline.json
Enter host password for user 'jnew...@gmail.com':
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://
www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=utf-8" />
<meta http-equiv="Content-Language" content="en-us" />
<title>Twitter: 404 NOT FOUND</title>
...

I have another request too, but I'll open another thread for that one.

Jesse
http://twitter.com/jnewland

On Mar 11, 1:32 am, "Blaine Cook" <rom...@gmail.com> wrote:
> Ahh, you're right. Fixed, and deploying now.
>
> b.
>

> On 3/10/07, jesse newland <jnewl...@gmail.com> wrote:
>
>
>
> > Blaine -
>
> > > curl -u usernamehttp://twitter.com/statuses/friends_timeline.json
> > This works fine.
>

> > > curl -u usernamehttp://twitter.com/statuses/user_timeline.json

jesse newland

unread,
Mar 14, 2007, 9:18:27 PM3/14/07
to Twitter Development Talk
Any progress on this? I'm still seeing a 404.

Thanks!
Jesse

On Mar 11, 10:14 am, "jesse newland" <jnewl...@gmail.com> wrote:
> Thanks for working on this for me! However, I'm still seeing a 404:
>

> $ curl -u jnewl...@gmail.comhttp://twitter.com/statuses/user_timeline.json
> Enter host password for user 'jnewl...@gmail.com':


> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
> <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
> <head>
> <meta http-equiv="Content-Type" content="text/html;
> charset=utf-8" />
> <meta http-equiv="Content-Language" content="en-us" />
> <title>Twitter: 404 NOT FOUND</title>
> ...
>
> I have another request too, but I'll open another thread for that one.
>

> Jessehttp://twitter.com/jnewland

Alex Payne

unread,
Mar 15, 2007, 11:56:53 PM3/15/07
to twitter-deve...@googlegroups.com
Jesse,

I've just checked in a fix for this issue. It'll be rolled out in
our next deploy. Thanks for your patience!

- Alex

Jeff Greco

unread,
Mar 16, 2007, 1:44:43 AM3/16/07
to Twitter Development Talk
Here's something somewhat related: What are the chances of getting an
RSS feed based off of Username instead of UserID?

- Jeff
twitter.com/jeffgreco

jesse newland

unread,
Mar 16, 2007, 5:38:04 AM3/16/07
to Twitter Development Talk
Thanks Alex! Congrats to all of the Twitter crew on their award at
SXSW - I'm sorry I missed the party.

Jesse

Alex Payne

unread,
Mar 16, 2007, 11:42:19 AM3/16/07
to twitter-deve...@googlegroups.com
Jeff,

I've just checked in code that allows you to get the results of
user_timeline and friends_timeline via id or username. That'll work
for RSS, Atom, XML, or JSON (as do basically all of our API
methods). We'll try to get these additions deployed soon.

Thanks for your suggestions!

--
Alex Payne
Obvious
http://twitter.com/al3x

alexkingorg

unread,
Mar 18, 2007, 1:36:10 AM3/18/07
to Twitter Development Talk
Really glad this is coming, hope it will be rolled out soon. I'm
holding off on my plugin release until I can test this - awesome not
to have to screen scrape to get the user id.

--Alex King

Personal http://alexking.org
Business http://kingdesign.net

DJ Fadereu

unread,
Mar 18, 2007, 2:19:17 AM3/18/07
to twitter-deve...@googlegroups.com
hey, any idea when Twitter will have a local
number in Bombay, India?

It's very expensive to use the London number!
It could catch up like mad here. India is
SMS-crazy!

Blaine Cook

unread,
Mar 18, 2007, 5:53:14 AM3/18/07
to twitter-deve...@googlegroups.com
Hey there,

We're actively working on expanding our global number pool, but no
firm time estimates are available. As an alternative, would a way to
send and receive Twitter messages via email work for most (or even
many) SMS users in India?

Blaine Cook
Obvious / twitter.com/blaine

Robert

unread,
Mar 19, 2007, 7:16:39 AM3/19/07
to Twitter Development Talk
Maybe you could use a J2ME application like Jargong (www.jargong.com)
on your mobile phone to read and update your Twitters? Then you only
have to pay for the GPRS data transfers.

Best regards,

Robert

DJ Fadereu

unread,
Mar 19, 2007, 8:19:07 AM3/19/07
to twitter-deve...@googlegroups.com
I've looked into that, but the situation is this. SMS
was not public culture in the US because of
email-enabled phones. In India, SMS is an almost
total phenomenon, and email/internet is still catching up.


If you had a local Twitter number, your server would
probably explode. As of December 2006, there
are 150 million users, with 65 million added only
last year.  That still leaves out about 900 million people.

Almost 90% with phones are using SMS.
--
-----
1/f  ))))))
-----
http://www.algomantra.com

RickMeasham

unread,
Mar 19, 2007, 5:23:11 PM3/19/07
to Twitter Development Talk
On Mar 19, 11:19 pm, "DJ Fadereu" <fade...@gmail.com> wrote:
> If you had a local Twitter number, your server would
> probably explode.

Probably not the kind of think Twitter wants to see :)

(Actually, I'm surprised that they do outbound SMS for free as it
is .. thanks Twitter!)

Cheers!
Rick Measham

RickMeasham

unread,
Mar 19, 2007, 10:08:47 PM3/19/07
to Twitter Development Talk

On Mar 17, 2:42 am, Alex Payne <a...@al3x.net> wrote:
> I've just checked in code that allows you to get the results of
> user_timeline and friends_timeline via id or username. That'll work
> for RSS, Atom, XML, or JSON (as do basically all of our API
> methods). We'll try to get these additions deployed soon.

Thanks Alex!

http://twitter.com/statuses/user_timeline.json

jesse newland

unread,
Mar 21, 2007, 8:47:09 AM3/21/07
to Twitter Development Talk
Thanks Alex. My TwitterAdium plugin (http://adiumxtras.com/index.php?
a=xtras&xtra_id=3484) has since been updated to use the user_timeline
call with a count of 1, and do some caching on my side - both in an
effort to be nicer to Twitter's servers.

Not to dig too deep, but are you guys using Rails fragment caching or
memcached behind the scenes at Twitter? Both seem to be very suited to
what this app does.

Jesse

Alex Payne

unread,
Mar 21, 2007, 4:34:39 PM3/21/07
to twitter-deve...@googlegroups.com
Jesse,

Thanks for configuring your plugin to be a little kinder to our
servers. Much appreciated.

We're on a big memcached push this week, and part of the work has
already been done and deployed. I'm presently working on a fragment
caching approach. Maintaining the correct privacy context for every
user is the real challenge there.

Thanks for the suggestions!


--
Alex Payne
Obvious
http://twitter.com/al3x

jesse newland

unread,
Mar 21, 2007, 8:57:24 PM3/21/07
to Twitter Development Talk
Rock on, sounds like you guys are on top of things. Good luck!

Jesse

On Mar 21, 4:34 pm, Alex Payne <a...@al3x.net> wrote:
> Jesse,
>
> Thanks for configuring your plugin to be a little kinder to our
> servers. Much appreciated.
>
> We're on a big memcached push this week, and part of the work has
> already been done and deployed. I'm presently working on a fragment
> caching approach. Maintaining the correct privacy context for every
> user is the real challenge there.
>
> Thanks for the suggestions!
>
> --
> Alex Payne

> Obvioushttp://twitter.com/al3x

Reply all
Reply to author
Forward
0 new messages