change order of registering api and capabilities to fix file version previews
reset collection to 'root' after adding a route to the api
introduce and use getCurrentConnection()
Merge pull request #9269 from owncloud/fix_versions_preview

change order of registering api and capabilities to fix file version previews