Feature/rest calls

Almost all the work here by @b97pla, but I did some refactoring at the end to fix the tests. Hopefully all is in order now.