Proper use of http://api.twitter.com/1/users/lookup.format with oAuth lib

277 views
Skip to first unread message

EastSideDev

unread,
Aug 4, 2011, 11:58:49 AM8/4/11
to Twitter Development Talk
I am using Abraham Williams' oAuth library. It's been working fine,
but I seem to have hit a snag on getting users profiles using
http://api.twitter.com/1/users/lookup.format.

Typically, I would do:

$oAuthConnection = new TwitterOAuth($keys['key'], $keys['secret'],
$keys['token'], $keys['TokenSecret']);

and then (for example), if I want to get my rate limit, I would do:

$content = $oAuthConnection->get('account/rate_limit_status');

or any number of other operations, but if I try to do:

$content = $oAuthConnection->get('users/lookup', array('user_id ' =>
$users_ids, 'include_entities' => 1));

Where $users_ids is a comma separated list (no more than 100), I am
getting nothing. Any ideas?

Abraham Williams

unread,
Aug 4, 2011, 12:43:54 PM8/4/11
to twitter-deve...@googlegroups.com
What is the response you are getting from Twitter?

Abraham
-------------
Abraham Williams | InboxQ | abrah.am | abraham+
@abraham | github.com/abraham | blog.abrah.am
This email is: [ ] shareable [x] ask first [ ] private.




--
Have you visited the Developer Discussions feature on https://dev.twitter.com/discussions yet?

Twitter developer links:
Documentation and resources: https://dev.twitter.com/docs
API updates via Twitter: https://twitter.com/twitterapi

Unsubscribe or change your group membership settings: http://groups.google.com/group/twitter-development-talk/subscribe

EastSideDev

unread,
Aug 4, 2011, 1:06:40 PM8/4/11
to Twitter Development Talk
Array
(
[errors] => Array
(
[0] => Array
(
[code] => 17
[message] => No user matches for specified terms
)

)

)

On Aug 4, 9:43 am, Abraham Williams <4bra...@gmail.com> wrote:
> What is the response you are getting from Twitter?
>
> Abraham
> -------------
> Abraham Williams | InboxQ <http://inboxq.com/> | abrah.am |
> abraham<https://plus.google.com/114233674199568482864>
> +
> @abraham <https://twitter.com/intent/follow?screen_name=abraham> |

EastSideDev

unread,
Aug 4, 2011, 1:12:09 PM8/4/11
to Twitter Development Talk
PS: I am actually testing to see if the string is numerical (user_id),
or text (screen_name), and then calling using one of the following
methods:

$content = $oAuthConnection->get('users/lookup', array('user_id ' =>
$users_ids, 'include_entities' => 1)); OR

$content = $oAuthConnection->get('users/lookup', array('screen_name'
=> $users_ids, 'include_entities' => 1));

Where $users_ids is a comma separated string containing up to 100
twitter IDs/screen_names

On Aug 4, 9:43 am, Abraham Williams <4bra...@gmail.com> wrote:
> What is the response you are getting from Twitter?
>
> Abraham
> -------------

Abraham Williams

unread,
Aug 4, 2011, 1:21:02 PM8/4/11
to twitter-deve...@googlegroups.com
That means that Twitter could not find any of the users you are looking up. Verify that you are requesting real users.

Abraham
-------------
Abraham Williams | InboxQ | abrah.am | abraham+

This email is: [ ] shareable [x] ask first [ ] private.

EastSideDev

unread,
Aug 4, 2011, 1:39:58 PM8/4/11
to Twitter Development Talk
mea culpa

I had a space before the hyphen following screen_name.

$content = $this->oAuthConnection->get('users/lookup',
array('screen_name ' => $users_ids, 'include_entities' => 1));

Removing the space fixes the problem.

On Aug 4, 10:21 am, Abraham Williams <4bra...@gmail.com> wrote:
> That means that Twitter could not find any of the users you are looking up.
> Verify that you are requesting real users.
>
> Abraham
> -------------
Reply all
Reply to author
Forward
0 new messages