views:

186

answers:

2

I am creating an application which requires twitter account , after I get credentials from an user , I want to check if that account exists or not. How can I do this with twitter4j ??? Note: I am using Google appengine

A: 

According to the api docs you can pass an email address to the user/ show method, I would assume that if a user didn't exist you'd get back a 404, which should allow you to determine whether or not the user exists.

eg: http://twitter.com/users/[email protected]

result if not exist :

<?xml version="1.0" encoding="UTF-8"?> 
<hash> 
  <request>/users/[email protected]</request> 
  <error>Not found</error> 
</hash
chipeau
A: 

In the new twitter API the email parameter has been deprecated.

Here is something that can use instead: http://api.twitter.com/1/users/show/username.xml

Replace username with the actual user name. If the user is not present, you will get an error message:

<?xml version="1.0" encoding="UTF-8"?>
<hash>
    <error>Not found</error>
    <request>/1/users/show/asdfsadfasdfasdf.xml</request>
</hash>
Niyaz