ed209
ed209

Reputation: 11293

Get a Twitter user with jQuery

I just want to validate that a Twitter user exists. My code is returning 401 Unauthorised with this

$("#getUsr").click(
    function()
    {
        var FindUser = $('#frmTwitter').val();
        $.getJSON(
            'http://api.twitter.com/1/users/' + FindUser + '.json?callback=?', 
            function(json) {
                console.log(json);
            }
        );
    }
);

what am I doing wrong?

Upvotes: 0

Views: 2199

Answers (3)

Declan Cook
Declan Cook

Reputation: 6126

All of Twitters API's require you to first authenticate with them.

http://dev.twitter.com/pages/auth

Upvotes: 0

Kevin Bowersox
Kevin Bowersox

Reputation: 94469

Try using this url: "http://api.twitter.com/1/users/show.json?screen_name=" + user_name

You can also look at this post: Check if twitter username exists

Upvotes: 0

Kissaki
Kissaki

Reputation: 9227

Where did you get that URI from?

Use instead:

'http://api.twitter.com/1/users/show.json?screen_name=' + FindUser

See API doc on users/show

Upvotes: 1

Related Questions