reader js: move all api requests to the new interface and do some cleanups in the code