API Convert queries to use paramaterised queries