Refactoring API to work with standard router.  Resolves #469 #454 #261

This is a minor rewrite of the API functionality to work with the standard routing schema.  I've removed the necessity for specific routing patterns and gone to a generic catch-all setup to match the main html-facing side.  I've avoided introducing sub-routers, but that would be a next logical step to move us towards a plugin-style architecture.

Note that it would be very useful to remove all calls to  and bring that into line with the standard error code handling in the  at some point - but I don't have time at th emoment.