Difference between revisions of "MG/Master Server"

From MegaGlest
Jump to navigation Jump to search
(First revision of Masterserver API documentation)
 
Line 33: Line 33:
 
This subdomain hosts the API which provides information on available game mods.
 
This subdomain hosts the API which provides information on available game mods.
  
'''Old-style URI's:'''
+
====Old-style URIs====
http://master.megaglest.org/showScenariosForGlest.php<br />http://master.megaglest.org/showMapsForGlest.php<br />http://master.megaglest.org/showTechsForGlest.php<br />http://master.megaglest.org/showTilesetsForGlest.php
+
http://master.megaglest.org/showScenariosForGlest.php<br />
 
+
http://master.megaglest.org/showMapsForGlest.php<br />
'''Mapping of old-style URIs to API URIs:'''
+
http://master.megaglest.org/showTechsForGlest.php<br />
 +
http://master.megaglest.org/showTilesetsForGlest.php
  
 +
====Mapping of old-style URIs to API URIs====
 
  OLD-STYLE URI              FUNCTION  VERB  API-URI
 
  OLD-STYLE URI              FUNCTION  VERB  API-URI
 
   
 
   
 
  /showMapsForGlest.php      ->          GET  /maps.csv
 
  /showMapsForGlest.php      ->          GET  /maps.csv
 
 
  /showScenariosForGlest.php -> (list)  GET  /scenarios.csv
 
  /showScenariosForGlest.php -> (list)  GET  /scenarios.csv
 
 
  /showTechsForGlest.php    -> (list)  GET  /techtrees.csv
 
  /showTechsForGlest.php    -> (list)  GET  /techtrees.csv
 
 
  /showTilesetsForGlest.php  -> (list)  GET  /tilesets.csv
 
  /showTilesetsForGlest.php  -> (list)  GET  /tilesets.csv
 
[[Category:MG]]
 
[[Category:MG]]

Revision as of 00:03, 10 July 2012

Masterserver RESTful API

This document describes a RESTful API design which MegaGlest could use to communicate with the Master Server.

Version 0.9

The first version of this API will try to provide a simple RESTful variant of the previous masterserver requests and responses. Its primary target is to provide backward compatibility to old-style URIs and requests in combination with HTTP redirections to the endpoints this API provides. On the other hand it shall provide a solid base to develop a proper RESTful API for the future. Nevertheless, this API version may add support for some new request types, i.e. add more functionality.

The most obvious difference to the previous interface is the newly introduced separation of gameserver related requests and game mod related requests into megaglest.org subdomains: master.megaglest.org and mods.megaglest.org.

Until explicitly noted otherwise, this is work in progress.


Host: master.megaglest.org

This subdomain hosts the API which provides information on available gameservers.

Old-style URI's:
http://master.megaglest.org/showServers.php
http://master.megaglest.org/showServersForGlest.php
http://master.megaglest.org/showServersJson.php
http://master.megaglest.org/addServerInfo.php

Mapping of old-style URIs to API URIs:

OLD-STYLE URI               FUNCTION  VERB  API-URI

/showServers.php         -> (list)    GET   /servers.html

/showServersForGlest.php -> (list)    GET   /servers.csv

/showServersJson.php     -> (list)    GET   /servers.json

/showRecentServers.php   -> (list)    GET   /servers-recent.html

/addServerInfo.php       -> (add)     POST  /server.txt/ip/<IP address>/version/<version>
                            (update)  PUT   /server.txt/ip/<IP address>/version/<version>


Host: mods.megaglest.org

This subdomain hosts the API which provides information on available game mods.

Old-style URIs

http://master.megaglest.org/showScenariosForGlest.php
http://master.megaglest.org/showMapsForGlest.php
http://master.megaglest.org/showTechsForGlest.php
http://master.megaglest.org/showTilesetsForGlest.php

Mapping of old-style URIs to API URIs

OLD-STYLE URI               FUNCTION  VERB  API-URI

/showMapsForGlest.php      ->          GET  /maps.csv
/showScenariosForGlest.php -> (list)   GET  /scenarios.csv
/showTechsForGlest.php     -> (list)   GET  /techtrees.csv
/showTilesetsForGlest.php  -> (list)   GET  /tilesets.csv