Finished to implement the javascript and fixed a couple of bugs on the ApiHandler.