Added internal support for running transactions via the REST API.

Please refer to the commit message for details, I worked hard on it!