Issue/135

Some work to the REST api to allow queries, sorting, limiting etc. Just a start, but can build on it as we go.