code: def put(self, name):
      if self.should_fail_with_auth_error() != AuthErrorStates.NONE:
          self.fail_with_auth_error()
          return
  
      self.logger.log(
          logging.DEBUG, f"Processing PUT for /endpoints/{name}"
      )
  
      try:
          if not self.request.body:
              self.error_out(400, "Input body cannot be empty")
              self.finish()
              return
          try:
              request_data = json.loads(
                  self.request.body.decode("utf-8")
              )
          except BaseException as ex:
              self.error_out(
                  400,
                  log_message="Failed to decode input body",
                  info=str(ex),
              )
              self.finish()
              return
  
          # check if endpoint exists
          endpoints = self.tabpy_state.get_endpoints(name)
          if len(endpoints) == 0:
              self.error_out(404, f"endpoint {name} does not exist.")
              self.finish()
              return
  
          new_version = int(endpoints[name]["version"]) + 1
          self.logger.log(
              logging.INFO, f"Endpoint info: {request_data}"
          )
          err_msg = yield self._add_or_update_endpoint(
              "update", name, new_version, request_data
          )
          if err_msg:
              self.error_out(400, err_msg)
              self.finish()
          else:
              self.write(self.tabpy_state.get_endpoints(name))
              self.finish()
  
      except Exception as e:
          err_msg = format_exception(e, "update_endpoint")
          self.error_out(500, err_msg)
          self.finish()
  
file_path: TabPy/tabpy/tabpy_server/handlers/endpoint_handler.py
imports: import json
  import logging
  import shutil
  from tabpy.tabpy_server.common.util import format_exception
  from tabpy.tabpy_server.handlers import ManagementHandler
  from tabpy.tabpy_server.handlers.base_handler import STAGING_THREAD
  from tabpy.tabpy_server.management.state import get_query_object_path
  from tabpy.tabpy_server.psws.callbacks import on_state_change
  from tabpy.tabpy_server.handlers.util import AuthErrorStates
  from tornado import gen
label_desc: Use image node_id 3 for calling the EndpointHandler obj's underlying member method code with example usage: obj.put(name) without return types