implemented api on dialog.html