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 the job is rejected by the executor, will runningExecutorInstances be decreased and will we become canAcceptWork?