New rest api and db functions

Also added distinct function to get unique values
Minor