Table of Contents
Introduction
The WTHashtag API allows anyone to interact directly with WTHashtag and request information via simple HTTP requests.
Core Concepts
All requests can be made in the form of GET requests.
Rate Limiting
We currently don't enforce any kind of a rate limit. We'll burn that bridge when we come to it :)
Error Handling
If an error occurs during a request, we'll return a special document telling you an error occurred and what it was
Data Parameters
These are the parameters that are globally accepted and will have some effect on the data received
- since - set the date where graphing should begin, e.g., since=2009-05-15
- until - set the date where graphing should end, e.g., until=2009-05-21
- since and until must be formatted YYYY-MM-DD. future dates not allowed for until parameter
Style Parameters
These are the parameters that are globally accepted and will only effect how your chart looks
Guidelines
- Alpha values must be between 1 and 100
- Color values are hexadecimal values with no # character, e.g., 982D3C
Parameters
- caption - set the caption of the graph, e.g., caption=my%20chart
- Please URL encode your captions - no apostrophes will be accepted
- Defaults to "Mentions of #hashtag on Twitter"
- subcaption - set the subcaption of the graph, e.g., subcaption=my%20company
- Please URL encode your subcaptions - no apostrophes will be accepted
- Defaults to "From since to until"
- width - set the width of the graph in pixels, e.g., width=450 (default is 450)
- height - set the height of the graph in pixels, e.g., height=300 (default is 300)
- type - set the type of chart received, options dependent on method
- xAxisName - set the label for the x-axis, e.g., xAxisName=Time
- yAxisName - set the label for the y-axis, e.g., yAxisName=Revenue
- showValues - display values for each data point, e.g., showValues=1
- rotateNames - rotate the x-axis data labels 90° counter-clockwise, e.g., rotateNames=1
- animation - toggle chart loading animation on or off , e.g., animation=0
- baseFontColor - set the color of the font, e.g., baseFontColor=873928
- bgColor - set the background color for the chart, e.g., bgColor=cccccc
- bgAlpha - set the alpha (opacity) for the background, e.g., bgAlpha=50
- canvasbgColor - set the background color for the chart area, e.g., canvasbgColor=eeeeee
- canvasbgAlpha - set the alpha (opacity) for the chart area, e.g., canvasbgAlpha=5
- canvasBorderColor - set the color of the border around the chart area, e.g., canvasBorderColor=ff0000
- canvasBorderThickness - set the thickness of the border around the chart area (in pixels), e.g., canvasBorderThickness=2
- showAlternateHGridColor - show or hide coloration for alternating horizontal divisions, e.g., showAlternateHGridColor=1
- alernateHGridColor - set the color for alternating horizontal divisions, e.g., alternateHGridColor=eeeeee
- showAlternateHGridColor must be set to 1
- alernateHGridAlpha - set the alpha (opacity) for alternating horizontal divisions, e.g., alternateHGridAlpha=50
- showAlternateHGridColor must be set to 1
- showAlternateVGridColor - show or hide coloration for alternating horizontal divisions, e.g., showAlternateVGridColor=1
- alernateVGridColor - set the color for alternating horizontal divisions, e.g., alternateVGridColor=eeeeee
- showAlternateVGridColor must be set to 1
- alernateVGridAlpha - set the alpha (opacity) for alternating horizontal divisions, e.g., alternateVGridAlpha=50
- showAlternateVGridColor must be set to 1
Methods
/chart/hashtag - graph a single hashtag's usage
Returns a graph depicting the usage of a single hashtag over a given timeframe.
http://api.wthashtag.com/chart/humor
Example Use (HTML):
<iframe src="http://api.wthashtag.com/chart/humor" width="500" height="350" style="border: none"></iframe>
Example Use (PHP):
file_get_contents("http://api.wthashtag.com/chart/humor");
Query Operators:
- color - set the color of the line & divider colors, e.g., color=25ace4
- can only be used with a line chart
- type - set the type of graph to return, e.g., type=column
/compare/hashtag/hashtag/hashtag - compare usage from multiple hashtags
Returns a graph depicting the usage of multiple hashtags over a given timeframe.
http://api.wthashtag.com/compare/humor/sarcasm
Example Use (HTML):
<iframe src="http://api.wthashtag.com/compare/humor/sarcasm" width="650" height="350" style="border: none"></iframe>
Example Use (PHP):
file_get_contents("http://api.wthashtag.com/compare/humor/sarcasm");
Query Operators:
- type - set the type of graph to return, e.g., type=bar
/define/hashtag/hashtag/... - get definitions for one or more hashtags
If making a GET request:
Returns short descriptions for requested hashtags or a generic "no description available" if we don't have one
http://api.wthashtag.com/define/followfriday
Example Use (PHP):
file_get_contents("http://api.wthashtag.com/define/followfriday/woofwednesday");
Query Operators
- format - set the return value format, e.g., format=xml