Add a new class Session for handling low-level networking and make API RESTful