User Tools

Site Tools


Sidebar

Content

Mapcraft - Fantasy map designer

WorldGen - SciFi universe generator

Mapcraft Web - Web based fantasy map designer

All code for the project is released under the GPL, and is copyright Samuel Penn.

The text on this wiki is dual licensed CC-BY-SA and GPL.

You can contact the author at sam@glendale.org.uk

worldgen:rest

REST

The WorldGen software provides a RESTful interface to most of the information stored in a universe's database. Basically, it allows the database to be queried using basic HTTP requests. As with all REST interfaces, the type of request is determined by the HTTP method used, i.e.:

  • Use a GET request to retrieve information.
  • Use a PUT request to add information.
  • Use a POST request to update existing information.
  • Use a DELETE request to delete existing information.

When performing a GET of information, the format of the information returned will generally default to XML. This format can be controlled by appending a suffix to the URL, i.e.:

  • Use .xml to get XML data returned as content type text/xml.
  • Use .txt to get XML data returned as content type text/plain (useful when you don't want the browser to perform any form of magic on the result).
  • Use .html to get a human friendly HTML page describing the data.
  • Use .jpg to get a graphic of the information (if available).

For example, /planet/567.html will get a prettily formated HTML page describing a world, whereas /planet/567.jpg will return a map of the world.

As with typical REST methodology, query strings are not used to determine what information to fetch, but may be used to modify how the data is formated. So, the URL format is normally <type of data>/<id>.<format>

To see it in action, have a look at http://dev.glendale.org.uk/mortals/sector/1.html

There are two main databases - Traveller and Mortals, which can be chosen by using either traveller or mortals in the URL. The former is more stable (I'm using it for a campaign, so the underlaying data can't change too much), but Mortals is more likely to have the latest features.

Some example APIs:

  • http://dev.glendale.org.uk/traveller/names/vilani - Get a randomly generated male Vilani name. Use a /female suffix to get a female name. You can also use solomani or planet instead of vilani. The latter will get a random star system name. The number parameter can be set to get more than one name at a time.
  • htpp://dev.glendale.org.uk/traveller/sector/Core Sector.html - Get information on Core Sector. Instead of the sector's name, you can also use either its unique id (which may change) or its coordinate, e.g. 0,-1.html will get Lishun Sector.
worldgen/rest.txt · Last modified: 2015/02/04 22:39 (external edit)