Hashtag in Twitter Has Many Functions Which Are Usually Unknown. Here is detailed guide on using Hashtag on Twitter by any level of user. Practically, this is the Twitter version of what we wrote on the article on Hashtag in Facebook. Previously, we discussed about the basics of Hashtag in our article – All About Hashtag and Tools for the Advanced Users. There are lot of Hashtag related API by Twitter. Unlike Facebook, Twitter API is not restricted to the partners in the Public Content Solutions program.
We have three more interesting article in this context, First is written in quite old article –Integrate the system of Twitter hashtags in WordPress posts, Second is not one but two, which intended for those who do not understand API – REST API or Representational State Transfer API, API Explained in Plain English and Third is the tool to test API – CocoaRestClient.
Hashtag in Twitter : Basics and Consumer Usage Part
By using strategic hashtags in your Twitter posts/Tweet, everyone will be able to see your hashtags as clickable links :
---
1 2 3 | https://twitter.com/hashtag/abhishekghosh?f=realtime&src=hash # or https://twitter.com/hashtag/computerandinternet?src=hash |
As you can see, with simple HTTP call or rather on browser we can view a particular category of Tweets. When you are getting retweeted, as the hashtags are also remaining with the share; basically one Tweet becoming multiple. This is, possibly one of the reason of popularity of Retweet from Tweet posted from a blog (like WordPress) with proper Hashtags.
Hashtag in Twitter : API and Developers’ Usage Part
Documentation of Twitter REST API v1.1 for Twitter Search is here :
1 | https://dev.twitter.com/docs/using-search |
So, to create a search, the primary part is :
1 | https://api.twitter.com/1.1/search/tweets.json?q= |
#hashtag
must be URL encoded. Twitter has a console too :
1 | https://dev.twitter.com/console |
URL Encoded form of #
is %23
, so for computerandinternet
it will be %23computerandinternet
. Full thing is becoming :
1 | https://api.twitter.com/1.1/search/tweets.json?q=%23computerandinternet |
But it will throw error because :
1 | https://dev.twitter.com/docs/auth/authorizing-request |
we need to authorize. In other words, you should create an App to hide your Key(s). This can be an example part of an App :
1 2 3 4 5 6 7 8 9 10 | // Your specific requirements $url = 'https://api.twitter.com/1.1/search/tweets.json'; $requestMethod = 'GET'; $getfield = '?q=#computerandinternet&result_type=recent'; // Perform the request $twitter = new TwitterAPIExchange($settings); echo $twitter->setGetfield($getfield) ->buildOauth($url, $requestMethod) ->performRequest(); |
Here is a full App :
1 | https://github.com/jfrazelle/hashtag-pull |