Added api-factory.js to facilitate generation of discoverable api and simplify
endpoint handling (currently used for admin-api).