Add request/response API

This pull request implements the features discussed in Issue #17.