handles RESTful requests