docstr: Update an existing form_data.
  ---
  put:
    summary: Update an existing form_data
    parameters:
    - in: path
      schema:
        type: string
      name: key
    - in: query
      schema:
        type: integer
      name: tab_id
    requestBody:
      required: true
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/FormDataPutSchema'
    responses:
      200:
        description: The form_data was stored successfully.
        content:
          application/json:
            schema:
              type: object
              properties:
                key:
                  type: string
                  description: The key to retrieve the form_data.
      400:
        $ref: '#/components/responses/400'
      401:
        $ref: '#/components/responses/401'
      404:
        $ref: '#/components/responses/404'
      422:
        $ref: '#/components/responses/422'
      500:
        $ref: '#/components/responses/500'
docstr_tok: ["Update","an","existing","form_data",".","--","-","put",":","summary",":","Update","an","existing","form_data","parameters",":","-","in",":","path","schema",":","type",":","string","name",":","key","-","in",":","query","schema",":","type",":","integer","name",":","tab_id","requestBody",":","required",":","true","content",":","application\/json",":","schema",":","$","ref",":","'","#","\/components\/schemas\/FormDataPutSchema'","responses",":","200",":","description",":","The","form_data","was","stored","successfully",".","content",":","application\/json",":","schema",":","type",":","object","properties",":","key",":","type",":","string","description",":","The","key","to","retrieve","the","form_data",".","400",":","$","ref",":","'","#","\/components\/responses\/400'","401",":","$","ref",":","'","#","\/components\/responses\/401'","404",":","$","ref",":","'","#","\/components\/responses\/404'","422",":","$","ref",":","'","#","\/components\/responses\/422'","500",":","$","ref",":","'","#","\/components\/responses\/500","'"]
code: def put(self, key: str) -> Response:
      """Update an existing form_data.
      ---
      put:
        summary: Update an existing form_data
        parameters:
        - in: path
          schema:
            type: string
          name: key
        - in: query
          schema:
            type: integer
          name: tab_id
        requestBody:
          required: true
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FormDataPutSchema'
        responses:
          200:
            description: The form_data was stored successfully.
            content:
              application/json:
                schema:
                  type: object
                  properties:
                    key:
                      type: string
                      description: The key to retrieve the form_data.
          400:
            $ref: '#/components/responses/400'
          401:
            $ref: '#/components/responses/401'
          404:
            $ref: '#/components/responses/404'
          422:
            $ref: '#/components/responses/422'
          500:
            $ref: '#/components/responses/500'
      """
      try:
          item = self.edit_model_schema.load(request.json)
          tab_id = request.args.get("tab_id")
          args = CommandParameters(
              datasource_id=item["datasource_id"],
              datasource_type=item["datasource_type"],
              chart_id=item.get("chart_id"),
              tab_id=tab_id,
              key=key,
              form_data=item["form_data"],
          )
          result = UpdateFormDataCommand(args).run()
          if not result:
              return self.response_404()
          return self.response(200, key=result)
      except ValidationError as ex:
          return self.response(400, message=ex.messages)
      except TemporaryCacheAccessDeniedError as ex:
          return self.response(403, message=str(ex))
      except TemporaryCacheResourceNotFoundError as ex:
          return self.response(404, message=str(ex))
  
file_path: superset/superset/explore/form_data/api.py
imports: import logging
  from flask import request, Response
  from flask_appbuilder.api import expose, protect, safe
  from marshmallow import ValidationError
  from superset.commands.explore.form_data.create import CreateFormDataCommand
  from superset.commands.explore.form_data.delete import DeleteFormDataCommand
  from superset.commands.explore.form_data.get import GetFormDataCommand
  from superset.commands.explore.form_data.parameters import CommandParameters
  from superset.commands.explore.form_data.update import UpdateFormDataCommand
  from superset.commands.temporary_cache.exceptions import TemporaryCacheAccessDeniedError, TemporaryCacheResourceNotFoundError
  from superset.constants import MODEL_API_RW_METHOD_PERMISSION_MAP
  from superset.explore.form_data.schemas import FormDataPostSchema, FormDataPutSchema
  from superset.extensions import event_logger
  from superset.views.base_api import BaseSupersetApi, requires_json, statsd_metrics
label_desc: Use image node_id 2 for calling the ExploreFormDataRestApi obj's underlying member method code with example usage: obj.put(key) and returns: self, self, self, self, self