Update rest.js

Added keys management and commented functions :)