Class Stimulus


  • @RequiredRole("admin")
    public class Stimulus
    extends APIRequestHandler
    Servlet that manages speech elicitation task stimuli files.

    /api/admin/elicit/stimulus[/file-name]

    The following operations, specified by the HTTP method, are supported:

    POST
    Upload a stimulus image/video. using a multipart POST request. (the first file parameter encountered is taken, regardless of its name).
    • Request Body - A multi-part encoded request with one file parameter (the first file parameter encountered is taken, regardless of its name). Accepted file types are: png, gif, jpeg, mp4.
    • Response Body - the standard JSON envelope, with the model as an object with the following attributes:
      file_size
      A string representing size of the file in bytes.
      file_content_type
      The file content type.
      file_name
      The name of the file on the server.
    • Response Status
      • 201 : The stimulus file was successfully created or replaced.
      • 415 : The file was not of a supported type.
    GET
    List stimulus files.
    • No parameters are required
    • Response Body - the standard JSON envelope, with the model as a corresponding array of file names.
    • Response Status
      • 200 : The records could be listed.
    DELETE
    Delete an existing file.
    • Request Path - /api/admin/elicit/stimulus/file-name.
    • Response Body - the standard JSON envelope, including a message if the request succeeds or an error explaining the reason for failure.
    • Response Status
      • 200 : The stimulus file was successfully deleted.
      • 415 : The file was not of a supported type.
      • 404 : The file was not found.
Author:
Robert Fromont robert@fromont.net.nz