Rework the extras API

Allow endpoint to return text or json using a ?format argument on the URL.