How to test for one user following another

31 views
Skip to first unread message

Joe Rattz

unread,
Oct 7, 2010, 6:15:45 PM10/7/10
to Twitter Development Talk
I would like to determine if my registered application's user is
following another user.

First I tried friendships/show with a target_screen_name = "someuser"
and get this error:

<hash>
<request>/1/friendships/show.xml</request>
<error>Target user not specified.</error>
</hash>


Then I tried friendships/show with user_a = "myusername" and user_b =
"someuser" and get this error:

<hash>
<request>/1/friendships/exists.xml</request>
<error>Two user ids or screen_names must be supplied.</error>
</hash>

I would prefer to use the show method and without having to specify my
application's user's username.

These are both using the Twulr Console. What am I missing?

Thanks.

Thomas Mango

unread,
Oct 7, 2010, 7:09:32 PM10/7/10
to twitter-deve...@googlegroups.com
You should be providing both the source and a target user to the
/friendships/show method.

You can use source_id & target_id or source_screen_name &
target_screen_name with /friendships/show.

Here's the API documentation:
http://dev.twitter.com/doc/get/friendships/show


--
Thomas Mango
tsm...@gmail.com


Joe Rattz

unread,
Oct 7, 2010, 7:24:37 PM10/7/10
to Twitter Development Talk
That doesn't work either:

<hash>
<request>/1/friendships/show.xml</request>
<error>Target user not specified.</error>
</hash>

That's right from Twurl despite the fact that I provided both the
source_screen_name and target_screen_name.

Besides, why shouldn't the other two methods work? They are
documented methods.
> tsma...@gmail.com- Hide quoted text -
>
> - Show quoted text -

Thomas Mango

unread,
Oct 7, 2010, 8:06:55 PM10/7/10
to twitter-deve...@googlegroups.com
I apologize, I was actually saying that you should specify both the
source and the target. It was my understanding you needed both, but it
looks like when you make an authenticated request (like you do with
twurl), you can specify just the target.

With that said, I was able to use twurl and specify only the target and
get it to work:

twurl "/friendships/show.xml?target_screen_name=Alternate1985"

This used my authenticated user, @tsmango, as the source and gave me the
proper response. Is that what your twurl call looked like?

Also, if you don't quote the query, you'll have problems with multiple
parameters:

This one works:
twurl
"/friendships/show.xml?source_screen_name=samvermette&target_screen_name=Alternate1985"

But this one fails with the error you were receiving:
twurl
/friendships/show.xml?source_screen_name=samvermette&target_screen_name=Alternate1985

Hope that helps and sorry again for the confusion about needed to
specify the source.


--
Thomas Mango
tsm...@gmail.com


Norhidayah Azman

unread,
Oct 7, 2010, 7:39:42 PM10/7/10
to Twitter Development Talk
Sometimes it's the case of simply the URL parser not recognizing the
'&' sign!

I tried using a couple of Python clients to make requests which need
more than one parameter -- thus needing the '&' sign in the API
request URL -- but the clients just break, giving me the same 'Target
user not specified' error.

Try formulating your request URL in your web browser first (requesting
XML output preferably), with example screen names for
source_screen_name and target_screen_name. If you're getting a correct
response from the web browser, then that means your client needs
tweaking to accept multiple parameters.

Dayah

Joe Rattz

unread,
Oct 19, 2010, 7:00:40 PM10/19/10
to Twitter Development Talk
I am not doing it from the command line with Twurl. I am doing it
from the Twurl Console that you provide and it doesn't work.

On Oct 7, 8:06 pm, Thomas Mango <tsma...@gmail.com> wrote:
> I apologize, I was actually saying that you should specify both the
> source and the target. It was my understanding you needed both, but it
> looks like when you make an authenticated request (like you do with
> twurl), you can specify just the target.
>
> With that said, I was able to use twurl and specify only the target and
> get it to work:
>
> twurl "/friendships/show.xml?target_screen_name=Alternate1985"
>
> This used my authenticated user, @tsmango, as the source and gave me the
> proper response. Is that what your twurl call looked like?
>
> Also, if you don't quote the query, you'll have problems with multiple
> parameters:
>
> This one works:
> twurl
> "/friendships/show.xml?source_screen_name=samvermette&target_screen_name=Al­ternate1985"
>
> But this one fails with the error you were receiving:
> twurl
> /friendships/show.xml?source_screen_name=samvermette&target_screen_name=Alt­ernate1985
Reply all
Reply to author
Forward
0 new messages