Class Upload


  • @RequiredRole("admin")
    public class Upload
    extends APIRequestHandler
    Servlet that allows a full task definition to be added/updated from a JSON file.

    /api/admin/elicit/task/upload

    The following operation, specified by the HTTP method, is supported:

    POST
    Upload a task definition JSON file using a multipart POST request. (the first file parameter encountered is taken, regardless of the parameter name). The name of the file (without the .json extension) is taken as the name of the task being uploaded. If there is already a task with that name, it will be replaced with the task in the file. Otherwise, a new task is created.
    • Request Body - A multi-part encoded request with one file parameter (the first file parameter encountered is taken, regardless of its name). The file must be .json.
    • Response Body - the standard JSON envelope, with the model as an object with the following attributes:
      task_id
      The database ID of the elicitation task.
      task_name
      The name of elicitation task.
    • Response Status
      • 200 : The existing task was successfully replaced.
      • 201 : The new task was successfully created.
      • 400 : No file was found.
      • 415 : The file was not of a supported type.
      • 422 : The file had an invalid structure.
Author:
Robert Fromont robert@fromont.net.nz