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.
If you've fixed this, I think we can merge and create a separate PR for fixing the tests