tweetvote api tweetvote is a very simple, RESTful web application that can be used directly via its HTML interface or by way of any REST-enabled application, such as a Twitter client with voting capabilities.

tweetvote exposes a REST resource, votes. A new vote can be created by executing a POST at /votes. The newly created resource will be assigned an id which can then be used to access, modify or delete the resource at /votes/id.

Some actions require authentication. Authentication is performed via HTTP Basic request headers, which will be directly forwarded to Twitter and checked there. Once Twitter makes OAuth tokens publicly available, those will be available as an alternative means of identifying users.

actions list
URL: http://tweetvote.infofaktur.de/votes[.format]
Method: GET
Formats: json, xml
Requires authentication: No

Returns a list of items (in the specified format) or a system message.

Request parameters:
  • vote_user: Twitter user ID or user name of the voting user.
  • tweet_user: Twitter user ID or user name of the author of the tweet that has been voted on.
  • status: Status ID to find votes for.
  • count: Number of items per page.
  • page: Page number.
create
URL: http://tweetvote.infofaktur.de/votes[.format]
Method: POST
Formats: json, xml, html
Requires authentication: Yes

The input type will be determined based on the Content-Type header of the request. Valid types are text/javascript for JSON content or text/xml for XML submissions. All other values will be treated as application/x-www-form-urlencoded, i.e. common POST forms. The created entity (in the specified format) or a system message will be returned.

Expected request fields:
  • tweet_id: Status ID to vote on.
  • weight: A floating point to describe the weight of the vote; subzero will be interpreted as a downvote.
view
URL: http://tweetvote.infofaktur.de/votes/id[.format]
Method: GET
Formats: json, xml, html
Requires authentication: No

Returns an item (in the specified format) or a system message.

update
URL: http://tweetvote.infofaktur.de/votes/id[.format]
Method: POST, PUT
Formats: json, xml, html
Requires authentication: Yes

The input type will be determined based on the Content-Type header of the request. Valid types are text/javascript for JSON content or text/xml for XML submissions. All other values will be treated as application/x-www-form-urlencoded, i.e. common POST forms. The updated entity (in the specified format) or a system message will be returned.

Expected request fields:
  • weight: A floating point to describe the weight of the vote; subzero will be interpreted as a downvote.
delete
URL: http://tweetvote.infofaktur.de/votes/id[.format]
Method: DELETE
Formats: json, xml, html
Requires authentication: Yes

Returns a system message in the specified format, reporting whether the deletion has been successful or not.

data formats vote entities
Votes can be read and written as either JSON, XML or HTML data.

JSON Example:
{
	"tweet_id": 1265072567, 
	"user_id": 14443226, 
	"id": 55, 
	"weight": -1.0, 
	"time": "Sun Mar  1 11:41:30 2009"
}
XML Example:
<?xml version='1.0' encoding='UTF-8'?>
<vote>
	<id>55</id>
	<tweet_id>1265072567</tweet_id>
	<user_id>14443226</user_id>
	<weight>-1.0</weight>
	<time>Sun Mar  1 11:41:30 2009</time>
</vote>


system messages
System messages are returned whenever no other response is available. They contain two fields:
  • status: a status type descriptor, i.e. error or success.
  • message: a plain-text description of the event.
System messages are encoded in the format specified by the client's request. An appropriate HTTP status code is set whenever possible.

JSON Example:
HTTP/1.0 404 Not Found
Date: Sun, 08 Mar 2009 20:36:32 GMT
Content-Type: text/html; charset=utf-8
Pragma: no-cache
Cache-Control: no-cache
Content-Length: 47

{
	"status": "error", 
	"message": "No such vote."
}

XML Example:
HTTP/1.0 404 Not Found
Date: Sun, 08 Mar 2009 20:37:31 GMT
Content-Type: text/html; charset=utf-8
Pragma: no-cache
Cache-Control: no-cache
Content-Length: 110


<status>
	<status>error</status>
	<message>No such vote.</message>
</status>