Post subject: TASVideos APIs
Emulator Coder
Joined: 3/9/2004
Posts: 4588
Location: In his lab studying psychology to find new ways to torture TASers and forumers
I realized we didn't have a thread to discuss our APIs, so I'm making one. Perhaps we should also have a page describing the available XML APIs, and perhaps some examples of what you can do with them. If you have any desires for API additions or modifications to the site to retrieve information easily, please list them here. If you have questions regarding API usage, ask here. ------------------ I've been considering allowing each RSS feed of a movie which obsoletes others to list them. Maybe using atom:contributor? Thoughts? There's also been a request to provide a per submission feed. Any additional data you want it to serve?
Warning: Opinions expressed by Nach or others in this post do not necessarily reflect the views, opinions, or position of Nach himself on the matter(s) being discussed therein.
Banned User, Former player
Joined: 3/10/2004
Posts: 7698
Location: Finland
A short summary (in this thread) of what is meant by "API" in this context (and what are things that can be done with it, with examples) would be nice, so that everyone will know what the subject is about.
Joined: 7/2/2007
Posts: 3960
"API" means "Application Programmer/Programming Interface". Basically this means that there are ways to directly access TASVideos' database by writing a program which makes requests over the network. For example, there might be a "getMovieInfo" function that TASVideos provides; your program sends a request to the TASVideos servers that looks broadly like "getMovieInfo(1812)" and the server sends you the same information that you can see here. This is more convenient and less resource-intensive than e.g. writing a program to scrape the site's webpages for that same information. That said, I have no idea what's in the API that TASVideos provides.
Pyrel - an open-source rewrite of the Angband roguelike game in Python.
Editor, Active player (296)
Joined: 3/8/2004
Posts: 7469
Location: Arzareth
Since I am the original author of TASVideos API, I could as well document it a bit. Here we go. This is machine-parseable documentation of the API.
desc   = "TASVideos query"
name   = "TasvideosQuery"
ns     = "urn:TasvideosQuery"
port   = "http://tasvideos.org/api.exe"
action = "urn:TasvideosQueryAction"

#   key
#      your user passkey
#   sql
#      your sql query
#      Note: The server reserves the right to edit your query
#            or to reject it alltogether if it tries either
#            to access sensitive data or if it would consume
#            too much of the server's resources.
#            If the query is not accepted, success will be
#            indicated as false.
#   perform
#      set to true if you actually want the query to be performed
#      false if just syntax checking and estimating cost
#   maxRows
#      maximum number of rows to return
#      Note: the site might still limit the number of rows
#            to a lower value, regardless of this value
#   est_cost
#      estimated cost of the given SQL query
#      (in no specific units)
#   pagename:
#      name of page to load without .html, such
#      as Rules, Bisqwit/Projects or 111M
#   wtxt:
#      wiki-formatted text contents of the page
#   html:
#      html-formatted content
#   relative_links:
#      set to true if you want the links returned in the html
#      to be rendered relative to the page's address, false if
#      you want them to be absolute
#   relative_base:
#      the prefix to add to all relative links in the response
#      (empty string is fine, but "../" is sometimes necessary)


[operation doDbQuery]
{string key, string sql, bool perform, int maxRows} in
{{bool success, string errorMessage, int numRows, int est_cost,
  string headers[], string columns[]} return} out

# Example:
#   for a query that returns 10 rows, each having 2 fields,
#   the "headers" array contains 2 entries and
#   the "column" array contains 20 entries:
#   r0c0, r0c1, r1c0, r1c1, r2c0, r2c1, ...

[operation doLoadPage]
{string key, string pagename} in
{{bool success, string errorMessage, string wtxt} return} out  

[operation doRenderWtxt]
{string key,string wtxt,bool relative_links, bool relative_base} in
{{bool success, string errorMessage,
  string html_header, string html_include,
  string html,        string html_footer} return} out

[operation doLoadMovieCategoryList]
{string key, int movieid} in
{{bool success, string errorMessage, string catlist[]} return} out

# Even entries: (p|n) id
# Odd  entries: textual description

[operation doIrcAgentAnnounce]
{string key, string magic, string message} in
{{bool success, string errorMessage} return} out
doDbQuery allows one to issue arbitrary read-only requests to the database in SQL language. Extensive syntax checking and load estimation is performed before the query is passed to the actual MySQL server. The database structure is supposed to be documented here: http://tasvideos.org/SiteTechnology/DataBase.html doLoadPage returns the latest wiki source code of the given web page. doRenderWtxt converts given wiki source code into HTML in the way TASVideos would do it if it was written on a page. Used for preview functions. doLoadMovieCategoryList is self-explanatory. doIrcAgentAnnounce is privileged. It is what TASVideos uses (or could use) internally to make TASVideoAgent say stuff. EDIT: The API is also documented here: http://tasvideos.org/SiteTechnology/API.html, along with example code in Ruby and in PHP.
Post subject: Info and Examples
Emulator Coder
Joined: 3/9/2004
Posts: 4588
Location: In his lab studying psychology to find new ways to torture TASers and forumers
We provide several public XML based APIs. Recent publications: http://tasvideos.org/publications.rss A list of systems and movies for them: http://tasvideos.org/systems.rss You can also access data on any movie: http://tasvideos.org/1234M.rss Just put in the number you want. There's an XBMC plug-in that makes use of it. Ilari also has a bunch of scripts that use it that he uses to automate updating parts of the site with.
Warning: Opinions expressed by Nach or others in this post do not necessarily reflect the views, opinions, or position of Nach himself on the matter(s) being discussed therein.
Former player
Joined: 4/17/2009
Posts: 88
use http://code.google.com/apis/chart/ on tas' with lots of improvements
Emulator Coder
Joined: 3/9/2004
Posts: 4588
Location: In his lab studying psychology to find new ways to torture TASers and forumers
I created a page which describes generic applications that can use our APIs, or approved applications made by our members which use our APIs.
Warning: Opinions expressed by Nach or others in this post do not necessarily reflect the views, opinions, or position of Nach himself on the matter(s) being discussed therein.