Class Upload
- java.lang.Object
-
- nzilbb.labbcat.server.api.APIRequestHandler
-
- nzilbb.labbcat.server.api.admin.elicit.task.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
-
-
Field Summary
-
Fields inherited from class nzilbb.labbcat.server.api.APIRequestHandler
SC_BAD_REQUEST, SC_CONFLICT, SC_CREATED, SC_FORBIDDEN, SC_INTERNAL_SERVER_ERROR, SC_METHOD_NOT_ALLOWED, SC_NOT_FOUND, SC_OK, SC_UNAUTHORIZED, SC_UNPROCESSABLE_CONTENT, SC_UNSUPPORTED_MEDIA_TYPE
-
-
Constructor Summary
Constructors Constructor Description Upload()Default constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description javax.json.JsonObjectpost(RequestParameters parameters, Consumer<Integer> httpStatus)POST handler - receive an uploaded stimulus file.-
Methods inherited from class nzilbb.labbcat.server.api.APIRequestHandler
getContext, GetSystemAttribute, init, writeResponse
-
-
-
-
Method Detail
-
post
public javax.json.JsonObject post(RequestParameters parameters, Consumer<Integer> httpStatus)
POST handler - receive an uploaded stimulus file.- Parameters:
parameters- Request parameter map.httpStatus- Receives the response status code, in case of error.- Returns:
- JSON-encoded object representing the response
-
-