The last few posts we covered a lot of ground:
- An overview of the Twitter API, and Twitter4J, which we will be using to access the Twitter API
- How to do Advanced Searches using Twitter
- HTTP Status Codes and Possible Error Codes
- How to generate credentials such as the Consumer Key and Access Token.
For this entry, we will be walking a user through setting up an API development environment with IntelliJ, Java, and Twitter4J.
Step One: Download and Install IntelliJ IDEA
- Download and Install the free Community Version of IntelliJ for your Mac or PC
Step Two: Set Up a New Project
- Run IntelliJ IDEA. The main splash screen should appear.
The IntelliJ IDEA splash screen |
- From the splash screen, select "Create Project".
- This time, let's create a Maven project. Select "Maven" in the left-hand menu, make sure that Java 1.8 is selected, and hit "Next".
Select Maven, the Java 1.8 SDK, and choose "Next". |
- What do you want to use as a group id? Since I have my website "tjmaher.com", I used that as a package name: com.tjmaher.
- What do you want to call the project? I selected TinkeringWithTwitter as a name. Select "Next".
Enter a group id, artifact id, and keep the default snapshot version. Select "Next". |
- Select "Finish" on the next screen.
- Your Java project is now set up!
Step Three: Set up the Twitter4J Dependencies in the POM.Xml file
- Review the "Maven Integration" section on the main page for Twitter4J on http://twitter4j.org/en/index.html
- Go to the pom.xml file that was created automatically in the root folder of the project.
- If it is not there already, after the group id, artifact id, and version, add the dependency block, placing the group id, artifact id, and version for Twitter4J inside it. It will look something like this:
<dependencies>
<dependency>
<groupId>org.twitter4j</groupId>
<artifactId>twitter4j-core</artifactId>
<version>[4.0,)</version>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.8</version>
<scope>test</scope>
</dependency>
</dependencies>
- The Twitter4J Java Library should automatically download.
- We will include the test framework TestNG.
Step Four: Set up the Twitter credentials for Twitter4J to use
- Once you are at the root folder of the project, create a new file by going to the horizontal menu, and select File -> New -> File.
- Create a new file "twitter4j.properties".
- Copy and paste the following code into the twitter4j.properties:
debug=true
oauth.consumerKey=****************
oauth.consumerSecret=****************
oauth.accessToken=****************
oauth.accessTokenSecret=****************
- Did you create a new Twitter account, create a Twitter app, and get credentials that this project could use? If not, follow the instructions.
- Cut-and-paste the consumer key, consumer secret, access token, and access token secret into the file, replacing the asterisks.
... Now, our project is all set! Next, we will work through posting Tweets to your Twitter account using Twitter4J!
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!"
3 comments:
https://cracklabs.info/sai-1-2-5-crack-torrent-key-full-version-free-download/
It is very informative. Very easy to understand. Great work team. Keep me updated for all such articles
Your work is great it provides me great knowledge visit below links..
Avast Premier Crack
SmartDraw Crack
CleanMyMac X Crack
Sketchup Pro Crack
Mua vé máy bay tại Aivivu, tham khảo
Vé máy bay đi Mỹ
vé máy bay từ mỹ về việt nam mùa dịch
giá vé máy bay từ đức về việt nam
chuyến bay từ nga về việt nam
vé máy bay từ anh về việt nam vietnam airlines
các chuyến bay từ châu âu về việt nam
giá vé máy bay tết
Post a Comment