In order to be able to programmatically interact with Twitter through their APIs, you need an:
- OAUTH Consumer Key
- Consumer Secret
- Access Token
- Access Token Secret
The file will look something like this:
twitter4J.properties
debug=true oauth.consumerKey=*********************
oauth.consumerSecret=******************************************
oauth.accessToken=**************************************************
oauth.accessTokenSecret=******************************************
.... Replace the lines of asterisks with the actual values once you get them.
How do we get our own OAUTH credentials for Twitter?
To be able to access Twitter APIs, you need to:
1) Create a Twitter Account:
- Go to Twitter.com and create an account for yourself.
2) Create a Twitter App to use the Twitter API
- Go to https://apps.twitter.com/ and choose to Create a new app.
- Come up with a name and a description of how your project will be using the Twitter APIs. I called mine: "Tinkering With Twitter".
- Are you creating a full blown app that will interact with a website you are creating? Enter it here. If not, enter a placeholder URL.
- Your app will be accessible from https://apps.twitter.com/
3) Find your new OAUTH Credentials.
- Go to https://apps.twitter.com/
- Select the link on the Dashboard to enter your Twitter App.
- Next to "Consumer Key and Access Key" select the link for "manage keys and access tokens".
There, you will see your:
- Consumer Key
- Consumer Secret
- Access Token
- Access Secret
Record these values, but don't share them, especially the secrets! You will be inputting them in a properties file once we set up the project.
With the next blog entry, we will talk about how to search with Twitter. Or if you want, you can jump right to the source code.
Happy Testing!
Tinkering With Twitter
- Part One: Twitter and the Twitter Search API
- Part Two: Getting the Twitter credentials: Consumer Keys and Access Tokens
- Part Three: Setting up an API Testing Environment with Twitter4J
- Part Four: Post a Tweet Using Twitter4J To Interact With the Twitter API
- GitHub: Review the source code for the project.
-T.J. Maher
Twitter | LinkedIn | GitHub
// Sr. QA Engineer, Software Engineer in Test, Software Tester since 1996.
// Contributing Writer for TechBeacon.
// "Looking to move away from manual QA? Follow Adventures in Automation on Facebook!"
1 comment:
When it comes to guilt, I can always advise something, for example, this site https://us.calmerry.com/blog/self-esteem/why-do-i-feel-guilty-for-no-reason/ has a blog about why I feel guilty about everything, it has all the details, and, fortunately, there is excellent online therapy with good psychotherapists .
Post a Comment