Uploaded image for project: 'Clowder'
  1. Clowder
  2. CATS-312

Make Files upload API accept multiple files & metadata

XMLWordPrintableJSON

    • Icon: Improvement Improvement
    • Resolution: Fixed
    • Icon: Normal Normal
    • Old Issues
    • None
    • API

      In /app/api/Files.scala, lots of shared code between:

      • upload() - for uploading file directly
      • uploadToDataset() - for uploading file to dataset

      Both endpoints expect one file with the input key "File" and don't allow one to associate metadata with the file in the same API call.

      To primarily reduce the number of calls required for large-scale project file transfers, I will create a utility upload function that takes a request and:
      1. If a key such as "File" is provided, upload only that file to preserve compatibility with existing code.
      2. If no keys are provided, all files found in the request will be uploaded.
      3. In both cases, if there is a JSON text input in the request with a key that matches one of the input filenames, it will be automatically associated with the uploaded file as metadata.

      This will allow existing code to work, but open the door for fewer necessary requests going forward.

              mburnet2 Maxwell Burnette
              mburnet2 Maxwell Burnette
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: