====== API Design ======
//This page goes with [(Forum [forum]~997)]//

**Goal**: The API will be a [[http://en.wikipedia.org/wiki/Representational_state_transfer|REST]]-like interface (but it will not adhere to the principles of REST in full detail -- we shall ignore annoying details such as multiple representations). The base URL will be https://www.fwurg.net/api, to prevent problems with same-origin policies. Instead of addressing the different 'modules' of the site as distinct entities, we shall strive to have an interface that instead offers access to the different conceptual entities (so ''topics'', ''pages'' and ''players'' instead of ''forum'', ''wiki'' and ''forum/accounts'').

Some examples of hypothetical methods (with HTTP verb in box):

{{template>method#get|''/players/<wrap var>brend</wrap>/characters<wrap optional>?type=rules:pc</wrap>'' -> Gets all Brend's characters (with query string: only those that are PCs)}}

{{template>method#post|''/topics/<wrap var>996</wrap>'' -> Posts to this topic (actual post content to be encoded as JSON in the request body)}}

{{template>method#post|''/pages/<wrap var>user:brend:test</wrap>'' -> Creates a new wiki page (actual page content to be encoded as JSON in the request body)}}

{{template>method#put|''/pages/<wrap var>ic:veolian_commonwealth_bookkeeping</wrap>'' -> Replaces the [[ic:veolian commonwealth bookkeeping]] page with the given content.}}

{{template>method#delete|''/media/<wrap var>user:brend-logo.png</wrap>'' -> Deletes the media ''user:brend-logo.png''.}}
