The Wayback Machine - https://web.archive.org/web/20120215084510/http://terrarianet.com:80/api-info.php

Terraria Server-List API Info

Re-Send Management Email
The API is a tool that anyone may use in order to pull information from the Server-List database.
Using the API developers can pull a list of servers in either JSON or XML format.
From there it can be parsed and displayed in any manner.

Here are some samples of the URL you would query for the feed.

www.TerrariaNet.com/feed.php << This feed is json formatted and includes all servers.
www.TerrariaNet.com/feed.php?or=1 << This feed is json formatted and includes only ONLINE servers.
www.TerrariaNet.com/feed.php?or=9 << This feed is json formatted and includes only HAMACHI servers.
www.TerrariaNet.com/feed.php?or=0 << This feed is json formatted and includes only OFFLINE servers.

www.TerrariaNet.com/feed.php?type=xml << This feed is xml formatted and includes all servers.
www.TerrariaNet.com/feed.php?type=xml∨=1 << This feed is xml formatted and includes only ONLINE servers.
and so on.


It is also possible to query a single or list of IP's, the api will pull the server info regardless if it is offline or online, it will ignore all other ip's.
www.TerrariaNet.com/feed.php?sip=204.232.209.59 << This feed pulls info in json format of the specified ip.
http://TerrariaNet.com/feed.php?sip=98.160.180.236;204.232.209.59&type;=xml << This feed pulls info in XML format of 2 servers delimited by ";".




The feeds are composed as such -> each server entry is indexed as server_'num'.
Each server entry then has its data entries as children. The available data is as follows.
'name' -- Name of the server
'link' -- Link to the server's page on the serverlist
'ip' -- server ip
'port' -- server port
'state' -- server state, when state is 1 server is online, 0 when offline, 9 when hamachi
'description' -- server description
'playerCount' -- server player count
'playerList' -- List of players online, delimited by ", " (comma and a space)



Here is a simple sample PHP script that produces a server monitor for your own website.


:
Server Offline or Full



:
Server Offline or Full




<?
    $ip 
"YOUR IP"// CHANGE TO YOUR SERVER IP
    
$url "http://gmodtheater.com/Terraria/feed.php?sip=".$ip;
    
$str file_get_contents($url);
    
$data json_decode($strtrue);
    echo 
"<center><table style=\"border: 2px solid;\"><tr><td><center>";
    echo 
"<b><a href=\"".$data["server_0"]["link"]."\">".$data["server_0"]["name"]."</a> </b><br>";
    echo 
"".$data["server_0"]["ip"]." : ".$data["server_0"]["port"]."<br>";
    if(
$data["server_0"]["state"] == "1"){
        echo 
"Server Online - ".$data["server_0"]["playerCount"]."/8<br>";
        echo 
$data["server_0"]["playerList"];
    }elseif(
$data["server_0"]["state"] == "9"){
        echo 
"Hamachi Server";
    }else{
        echo 
"Server Offline or Full";
    }
    echo 
"</center></td></tr></table></center>";
    
?>



Allthough it's not required, if you do use the API I would really appreciate a link-back. Thanks.
If you make something cool and want to share it, feel free to send it to Nexzed@gmail.com