TASVideos

Tool-assisted game movies
When human skills are just not enough

Site Technology / API

<< Site Technology

Table of contents [expand all] [collapse all]

SOAP API for site

This site contains a SOAP API that defines three[1] requests:

The WSDL file that defines this service, can be downloaded here: http://tasvideos.org/api.wsdl

As an extension to the SOAP standard, if you prefer to receive the response in JSON format instead of as XML (for ease of use with Javascript applications), attach the ?out=json string to the callpoint URI.

When you develop your client program, please save a local copy of that WSDL file, instead of loading it from the server each time.

User key

Each query requires a key, which identifies the user/developer in question.

You can acquire a key from Nach if you explain your needs well enough. Temporary (a day or week) keys for testing may be granted by just asking.

Supported SELECT statement syntax

   request =
     [ (DESC|DESCRIBE|EXPLAIN) [EXTENDED] ] query.
   
   query =
    (SELECT
       [DISTINCT]
       ( '*'
       | (expression [ [ AS ] name ]) % ','
       )
    [ FROM table_refs
      [ WHERE    expression ]
      [ GROUP BY (expression [ASC | DESC]) % ',' ]
      [ HAVING   expression ] ]
    [ ORDER BY (expression [ASC | DESC]) % ',' ]
    [ LIMIT integer
       ( OFFSET integer
       | ( ',' integer )?
       ) ]
    ) % (UNION [ DISTINCT | ALL ])
     .

   table_refs =
       ( table_name [ [ AS ] table_alias ]
       | '(' table_refs ')'
       | LEFT JOIN table_refs ( ON expression
                              | USING '(' (name % ',') ')'
                              )
       ) % ','.

   name = field_name_or_alias.

   expression =
    ( expr_head*
      ( [table_name_or_alias '.'] name
     | TRUE
     | FALSE
     | numeric_constant
     | string_constant 
     | expression
     | [ EXISTS ] '(' query ')'
     | COUNT '(' [ DISTINCT ] ( '*' | expression ) ')'
     | [ SUM | LENGTH | AVG | FLOOR ] '(' expression ')'
      ) expr_tail*
     ) % expr_sep.

    expr_head = NOT | '!' | '-' | '+'.

    expr_tail =
        IS [ NOT ] NULL
      | [ NOT ] IN '(' ( query
                      | ( expression % ',' )
                        ) ')'
      | BETWEEN expression AND expression
      | LIKE string_constant.
    
    expr_sep =
           '+' | '-' | '/' | '*' | '^'
         | '=' | '<' | '>' | '<=' | '>=' | '!=' | '<>'
         | AND | OR | XOR | MOD.
The syntax is also available as a graphical flowchart at http://bisqwit.iki.fi/kala/snap/tasvqueryflowchart.png. However, it is a large image.

The API can also access portions of the forums by prefixing the table name (phpBB standard table names) with the database name, for example: select count(*) from nesvideos_forum.posts. Do note that not all tables and fields can be accessed.

Example client program 1

This example program, written in PHP, queries and gets the list of all currently published Game Boy movie file names:
  <?php
  $key = YOUR_USERKEY_HERE;
  $sql = 'select filename from movie m,movie_file f,filetype t,system s'.
         'where m.id=movieid and t.id=typeid and filetypeclass="M"'.
         'and obsoleted_by=-1 and s.id=systemid and abbr="GB"';
  $soap_options = Array('compression' => SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_GZIP);
  $client = new SoapClient('TasvideosQuery.wsdl', //  this file must exist
                           $soap_options);
  $response = $client->doDbQuery($key, $sql, true, 5000);
  print_r($response->columns);

Example client program 2

This example program, written in Ruby, fetches the source code of the Movie Rules page:

  require 'soap/wsdlDriver.rb'
  key = YOUR_USER_KEY_HERE          ##  this file must exist
  client = SOAP::WSDLDriverFactory.new('TasvideosQuery.wsdl').create_rpc_driver
  response = client.doLoadPage(key, 'Rules')
  print response.wtxt

Limitations

The SQL interface has limitations on how often it can be accessed. It also tries to protects itself against queries that cause tons of database load.

These values are currently held in secret, but should not cause problems if you don't access the site too often. Depending on the query (and the popularity of this API), the minimum allowed time between queries may range from 15 seconds to 2 hours.

SOAP API for tracker

The BitTorrent Tracker also has a SOAP API. It defines the following four requests[1]:

The WSDL file that defines this service, can be downloaded here: http://tracker.tasvideos.org/api.wsdl

As an extension to the SOAP standard, if you prefer to receive the response in JSON format instead of as XML, attach the ?out=json string to the callpoint URI.

When you develop your client program, please save a local copy of that WSDL file, instead of loading it from the server each time.


See also:

[1]: It actually defines more than those, but the rest of them are used by the site internally and require authentication tokens for access.



Combined RSS Feed
SiteTechnology/API last edited by Ilari on 2012-08-14 05:06:03
Page info and history | Latest diff | List referrers | View Source