Retrieving the page HTML via api.php is probably inefficient. We've observed that the time to first byte is very high (over a second, sometimes two) and the time spent transmitting data very low (a few hundred milliseconds). Additionally, the API wraps the page HTML in a JSON blob which we then have to decode.
Instead, we should send two separate requests, one for the page HTML directly to RESTbase, and one for a JSON blob of auxiliary information to api.php.