Class Store
- java.lang.Object
-
- nzilbb.labbcat.server.api.APIRequestHandler
-
- nzilbb.labbcat.server.api.Store
-
- nzilbb.labbcat.server.api.edit.Store
-
- nzilbb.labbcat.server.api.admin.Store
-
public class Store extends Store
Endpoints starting /api/admin/store/… provide an HTTP-based API for access to GraphStore functions. This includes all requests supported byStore
andStore
.The endpoints documented here only work for POST or PUT HTTP requests and return a JSON response with the same standard envelope structure:
- title
- (string) The title of the LaBB-CAT instance.
- version
- (string) The version of the LaBB-CAT instance
- code
- (int) 0 if the request was successful, 1 if there was a problem
- messages
- An array of message strings.
- errors
- An array of error message strings.
- model
- The result of the request, which may be a JSON object, JSON array, or a simple type.
e.g. the response to http://localhost:8080/labbcat/api/admin/store/newLayer might be:
{ "title":"Store", "version":"20230403.1833", "code":0, "errors":[], "messages":[ "Layer added: test-layer" ], "model":{ "alignment":0, "category":"", "description":"", "id":"test-layer", "parentId":"segment", "parentIncludes":true, "peers":true, "peersOverlap":true, "saturated":true, "type":"string", "validLabels":{}, "notes":"" } }
If the
Accept-Language
request header is set, the server will endeavor to localize messages to the specified language.User authorization for password-protected instances of LaBB-CAT uses the 'Basic' HTTP authentication scheme. This involves sending an
Authorization
request header of the form Basic TTTTTTTT, where TTTTTTTT is an authentication token formed by base64-encoding a string of the form username:password-
/api/admin/store/newLayer
Adds a new layer. Only the POST or PUT HTTP method is supported.- Request Body - a JSON-encoded object representing the layer definition, with the following structure:
-
id
: The ID of the layer to create. -
parentId
: The layer's parent layer id. -
description
: The description of the layer. -
alignment
: The layer's alignment - 0 for none, 1 for point alignment, 2 for interval alignment. -
peers
: Whether children on this layer have peers or not. -
peersOverlap
: Whether child peers on this layer can overlap or not. -
parentIncludes
: Whether the parent temporally includes the child. -
saturated
: Whether children must temporally fill the entire parent duration (true) or not (false). -
type
: The type for labels on this layer, e.g. string, number, boolean, ipa. -
validLabels
: List of valid label values for this layer, or null if the layer values are not restricted. The 'key' is the possible label value, and each key is associated with a description of the value (e.g. for displaying to users). -
validLabelsDefinition
: Optional list of valid label values for this layer.LaBB-CAT extends the
Layer.validLabels
funcionality by supporting an alternative layer attribute: validLabelsDefinition, which is an array of label definitions, each definition being a map of string to string or integer. Each label definition is expected to have the following attributes:- label
- what the underlying label is in LaBB-CAT (i.e. the DISC label, for a DISC layer)
- legend
- the symbol on the label helper or in the transcript, for the label (e.g. the IPA version of the label) - if there's no legend specified, then there's no option on the label helper (so that type-able consonants like p, b, t, d etc. don't take up space on the label helper)
- description
- tool-tip text that appears if you hover the mouse over the IPA symbol in the helper
- category
- the broad category of the symbol, for organizing the layout of the helper
- subcategory
- the narrower category of the symbol, for listing subgroups of symbols together
- display_order
- the order to process/list the labels in
validLabelsDefinition takes precedence over validLabels - i.e. if validLabelsDefinition is present, it's label options are saved. Otherwise, the validLabels options are saved.
-
category
: Category for the layer, if any.
-
- Response Body - the standard JSON envelope, with the model as an object representing the layer defintion actually saved, using the same stucture as the body.
- Response Status
- 200 : The layer was successfully saved.
- 400 : The layer was not successfully saved.
- Request Body - a JSON-encoded object representing the layer definition, with the following structure:
-
/api/admin/store/saveLayer
Saves changes to a layer, or adds a new layer. Only the POST or PUT HTTP method is supported.- Request Body - a JSON-encoded object representing the layer definition, with the following structure:
-
id
: The ID of the layer to update. -
parentId
: The layer's parent layer id. -
description
: The description of the layer. -
alignment
: The layer's alignment - 0 for none, 1 for point alignment, 2 for interval alignment. -
peers
: Whether children on this layer have peers or not. -
peersOverlap
: Whether child peers on this layer can overlap or not. -
parentIncludes
: Whether the parent temporally includes the child. -
saturated
: Whether children must temporally fill the entire parent duration (true) or not (false). -
type
: The type for labels on this layer, e.g. string, number, boolean, ipa. -
validLabels
: Map of valid label values for this layer, which may be empty if the layer values are not restricted. The 'key' is the possible label value, and each key is associated with a description of the value (e.g. for displaying to users). -
validLabelsDefinition
: Optional list of valid label values for this layer.LaBB-CAT extends the
Layer.validLabels
funcionality by supporting an alternative layer attribute: validLabelsDefinition, which is an array of label definitions, each definition being a map of string to string or integer. Each label definition is expected to have the following attributes:- label
- what the underlying label is in LaBB-CAT (i.e. the DISC label, for a DISC layer)
- legend
- the symbol on the label helper or in the transcript, for the label (e.g. the IPA version of the label) - if there's no legend specified, then there's no option on the label helper (so that type-able consonants like p, b, t, d etc. don't take up space on the label helper)
- description
- tool-tip text that appears if you hover the mouse over the IPA symbol in the helper
- category
- the broad category of the symbol, for organizing the layout of the helper
- subcategory
- the narrower category of the symbol, for listing subgroups of symbols together
- display_order
- the order to process/list the labels in
validLabelsDefinition takes precedence over validLabels - i.e. if validLabelsDefinition is present, it's label options are saved. Otherwise, the validLabels options are saved.
-
category
: Category for the layer, if any.
-
- Response Body - the standard JSON envelope, with the model as an object representing the layer defintion actually saved, using the same stucture as the body.
- Response Status
- 200 : The layer was successfully saved.
- 400 : The layer was not successfully saved.
- Request Body - a JSON-encoded object representing the layer definition, with the following structure:
-
/api/admin/store/deleteLayer
Deletes an existing layer. Only the POST or PUT HTTP method is supported.- Request Body - a application/x-www-form-urlencoded body with the following parameter:
-
id
: The ID of the layer to delete.
-
- Response Body - the standard JSON envelope, with the model as an object representing the layer defintion actually saved, using the same stucture as the body.
- Response Status
- 200 : The layer was successfully deleted.
- 400 : The layer was not successfully deleted.
- Request Body - a application/x-www-form-urlencoded body with the following parameter:
-
/api/edit/store/destroyAnnotation
Destroys the annotation with the given ID.- Parameters:
id
- The ID of the transcript.annotationId
- The annotation's ID.
-
/api/edit/store/deleteTranscript
Deletes the given transcript, and all associated files.- Parameters:
id
- The ID transcript to delete.
-
/api/admin/store/newAnnotatorTask
Create a new annotator task with the given ID and description.- Parameters:
- annotatorId
- The ID of the annotator that will perform the task.
- taskId
- The ID of the task, which must not already exist.
- description
- The description of the task.
-
/api/admin/store/saveAnnotatorTaskDescription
Update the annotator task description.- Parameters:
- taskId
- The ID of the task, which must already exist.
- description
- The description of the task.
-
/api/admin/store/saveAnnotatorTaskParameters
Update the annotator task parameters.- Parameters:
- taskId
- The ID of the task, which must already exist.
- parameters
- The task parameters, serialized as a string.
-
/api/admin/store/deleteAnnotatorTask
Delete the identified automation task..- Parameters:
- taskId
- The ID of the task, which must already exist.
- Author:
- Robert Fromont robert@fromont.net.nz
-
-
Field Summary
-
Fields inherited from class nzilbb.labbcat.server.api.APIRequestHandler
SC_BAD_REQUEST, SC_CONFLICT, SC_FORBIDDEN, SC_INTERNAL_SERVER_ERROR, SC_METHOD_NOT_ALLOWED, SC_NOT_FOUND, SC_OK, SC_UNPROCESSABLE_CONTENT, SC_UNSUPPORTED_MEDIA_TYPE
-
-
Constructor Summary
Constructors Constructor Description Store()
Default constructor.
-
Method Summary
-
Methods inherited from class nzilbb.labbcat.server.api.APIRequestHandler
GetSystemAttribute, init, writeResponse
-
-