How to Post to Twitter using Java

Today i am telling you how to post your content to Twitter using Java. They provides a rich REST API to create Twitter enabled applications.
Before going forward to coding we need to generate Twitter API keys which enables us to access the APIs.
We need to get "Consumer Key" and "Consumer Secret" from Twitter. Using these two, we should generate, "Access Token" and "Access Token Secret".
How to Twitter Consumer Key and Consumer Secret
  • Go to the URL https://dev.twitter.com/apps and create a new application. 
  • Give access level in ‘Settings’ as ‘Read, Write and Access direct messages’. 
  • You will get both consumer key and secret.
How to Post to Twitter using Java,Post to Twitter using Java,Twitter using Java,



Twitter Access Token
  • We can generate access tokens using the consumer keys. It can be done using the API or through the interface as well.
  • I am going with generating using the Twitter website itself as shown below. Ensure that the access level comes the same as in consumer keys or regenerate it.

No comments:

Post a Comment