Factor our reply helper function and api_request.