Some more changes to properly handle the "api" requests

Signed-off-by: emanuele <emanuele45@gmail.com>
And the javascript to handle the notification button

Signed-off-by: emanuele <emanuele45@gmail.com>