refactored api to use httpresponsemessage