Twitter API for fetching user information


#1

I am not able to fetch user data for social connect with twitter. I am only able to login to twitter account through my twitter credentials. Can u tell me the twitter API’s for fetching the user information and redirect the user to a page with prepopulated form fields. Where can i get the required twitter API?


#2

What exactly are you trying to do? There is the [users/lookup][1] API endpoint for bulk user lookups or the [users/show][2] to look up a single user.
To get the user object for the currently identified user (the users for which the current tokens are valid), there is the [account/verify_credentials][3] endpoint.
[1]: https://dev.twitter.com/rest/reference/get/users/lookup
[2]: https://dev.twitter.com/rest/reference/get/users/show
[3]: https://dev.twitter.com/rest/reference/get/account/verify_credentials


#3

i have created a form with a tweet button on it. When the user clicks the tweet button , the user should be able to login to his twitter account by entering the login twitter credentials . After logging in , the user must be redirected to a page which contains the form with prefilled user information. Kindly suggest me the way to fetch user data and to prepopulate the form


#4
  • from where can we refer the documentation for API?
  • Is it paid or free?

#5

I’ve already linked you to the important Documentation pages. The API usage is normally free.


#6

Could you please elaborate how to use that API?


#7

I don’t understand your question. All information needed should be in the docs. What is you exact problem?


#8

For example, we use graph API for Facebook.
FB.api(’/me’, function(response) {

    console.log(JSON.stringify(response));

Could you please mention some similar API for Twitter as well.


#9

What you seem to use is a framework to interact with the API. What programming language are you using? (Oh an please indent code with 4 spaces so it displays properly as code)


#10

I am using java. I want to prepopulate the data in the form.
I am using the below code and not able to figure out the API for this

Tweet

<form>
    <fieldset>

        <div class="row">
            <div class="small-12 medium-4 columns">
                <label><font style="color:red">*</font>First Name:</label>
                <label> <input type="text" placeholder="First Name"
                    tabindex="" title="Please Enter Your First Name." id="firstName" name="firstName" required/>
                </label> 
            </div>
        </div>


        <div class="row">
            <div class="small-12 medium-4 columns">
                <label><font style="color:red">*</font>Last Name:</label>
                <label> <input type="text" placeholder="Last Name"
                    tabindex="" title="Please Enter Your Last Name." id="lastName" name="lastName" required/>
                </label>
            </div>
        </div>
       
       
        <div class="row evo-btn-row">
            <div class="small-12 columns">
                <button class="button expand radius show-for-small-only evo-btn"
                    data-evo-button-icons="right" id="" name="" value="" type="" 
                    tabindex="" title="Log In">
                    <span class="evo-btn-text">Submit</span> <i
                        class="evo-icon-position-right" title=""></i>
                </button>
                <button class="button radius show-for-medium-up evo-btn"
                    data-evo-button-icons="right" id="" name="" value="" type="" 
                    tabindex="" title="Log In">
                    <span class="evo-btn-text">Submit</span> <i
                        class="evo-icon-position-right" title=""></i>

                </button>

            </div>

        </div>
    </fieldset>
</form>

#11

On click of Tweet button, i should be able to login to twitter account by entering my credentials. Then i must be redirected to a page with form containing prefilled values.


#12

It seems you haven’t much experience how the Twitter API works, but I can’t explain to you the whole API here, that’s very out of scope of this forum. There are API docs for a reason. If they are not enough, you still can ask specific questions but just “tell me how to use the API” is not possible to answer.


#13

Can u plz tell some link or documentation from where i can read about Twitter API?


#14

I’ve already done so in my first post so all you had to do was to click on a method name and from there on check out more docs… Anyway HERE (click me) are the docs.


#15

Yes. Thank you for that. I referred to the links sent in your first post but could not figure out much. Could you plz tell which API to use and how?


#16

I already pointed you to the relevant documentation. If you can’t figure out how to use the API and can’t ask questions that are specific enough to show me that you have at least some basic understanding of how an REST API works, I can’t provide any further help.
It seems that you are confusing a HTTP API with a library. Those things are not the same.
The Twitter API are HTTP resources you can access to fetch specific information, how you fetch those is not part of the API. There are a variety of libraries you can try, you can find those in the documentation too.