Viralheat | Sentiment Analysis API
Headline_dev_center_950_116

Sentiment Analysis API Methods

Viralheat is a social media measurement platform that allows you to track topics, brands, television shows, and movies across many different mediums all in one place using the best technology. The users of Viralheat choose to share a subset of their profiles with the world. Sentiment Analysis API is freely available to everyone with a developer account.
Method 1: Get Sentiment
URL (JSON): http://www.viralheat.com/api/sentiment/review.json?text=i%20dont%20like%20this&api_key=[*** your api key ***]
URL (XML): http://www.viralheat.com/api/sentiment/review.xml?text=i%20dont%20like%20this&api_key=[*** your api key ***]
Format: XML, JSON
HTTP Method: GET
Requires Authentication: Yes
Parameters:
api_key: The authenticated account key.
text: Text for which you want the sentiment. The limit on the text is 360 characters.

Return Values:
prob: The probability with which the system thinks the given text has the output sentiment
mood: Sentiment output for the given text.
text: Input text for which the sentiment was generated.

Sample response (XML):
			  
<?xml version="1.0" encoding="UTF-8"?> 
<result> 
  <text>i dont like this</text> 
  <mood>negative</mood> 
  <prob>0.773171679917001</prob> 
</result>    	  
			  
			
Method 2: Train the Sentiment Analysis Engine
URL (JSON): http://www.viralheat.com/api/sentiment/train.json?text=i%20dont%20like%20this%20coffee&api_key=[*** your api key ***]&mood=negative
URL (XML): http://www.viralheat.com/api/sentiment/train.xml?text=i%20dont%20like%20this%20coffee&api_key=[*** your api key ***]&mood=negative
Format: XML, JSON
HTTP Method: GET
Requires Authentication: Yes
Parameters:
api_key: The authenticated account key.
text: Text for which you want the sentiment. The limit on the text is 250 characters.
mood: Desired sentiment value for the given text. Values could either be positive or negative

Return Values:
status: The status of the call made to train the sentiment analysis engine.

Sample Response:
			  
<?xml version="1.0" encoding="UTF-8"?> 
<result> 				
  <status>ok</status>
</result>
			  
			
Method 3: Check Sentiment API usage quota
URL (JSON): http://www.viralheat.com/api/sentiment/quota.json?api_key=[*** your api key ***]
URL (XML): http://www.viralheat.com/api/sentiment/quota.xml?api_key=[*** your api key ***]
Format: XML, JSON
HTTP Method: GET
Requires Authentication: Yes
Parameters:
api_key: The authenticated account key.

Return Values:
quota_remaining: Your current usage quota for the Sentiment API's'

Sample Response:
			  
<?xml version="1.0" encoding="UTF-8"?> 
<result>
  <quota_remaining>4550</quota_remaining>
</result>