Backend to the eLaborate project
Switch branches/tags
testdeploy_2014.04.29.17.25.02 testdeploy_2014.04.23.13.22.50 testdeploy_2014.04.22.17.28.51 testdeploy_2014.04.15.15.59.33 testdeploy_2014.04.14.16.05.40 testdeploy_2014.04.14.11.22.04 testdeploy_2014.04.14.10.06.32 testdeploy_2014.04.14.09.59.41 testdeploy_2014.04.11.16.21.38 testdeploy_2014.04.11.15.44.57 testdeploy_2014.04.11.14.32.10 testdeploy_2014.04.11.12.18.44 testdeploy_2014.04.09.13.22.48 testdeploy_2014.04.09.12.43.40 testdeploy_2014.04.04.17.28.25 testdeploy_2014.04.01.17.30.46 testdeploy_2014.04.01.10.30.23 testdeploy_2014.03.31.17.10.16 testdeploy_2014.03.31.16.19.09 testdeploy_2014.03.27.11.47.20 testdeploy_2014.03.24.10.49.44 testdeploy_2014.03.20.14.21.26 testdeploy_2014.03.19.16.35.22 testdeploy_2014.03.19.10.05.17 testdeploy_2014.03.17.10.14.08 testdeploy_2014.03.05.15.03.43 testdeploy_2014.03.05.14.58.03 testdeploy_2014.02.25.14.03.21 testdeploy_20140225131138 testdeploy_20140225122918 testdeploy_20140225114830 testdeploy_20140225110049 testdeploy_20140224175533 testdeploy_20140224174635 testdeploy_20140224174609 testdeploy_20140224102346 testdeploy_20140224101940 testdeploy_20140224095452 testdeploy_20140213114454 testdeploy_20140127115900 testdeploy_20140115175932 testdeploy_20140109121026 testdeploy_20131219102903 testdeploy_20131218161701 testdeploy_20131218160948 testdeploy_20131218135708 testdeploy_20131218121913 testdeploy_20131217172616 testdeploy_20131217153838 testdeploy_20131216183232 testdeploy_20131216174238 testdeploy_20131216162637 testdeploy_20131216162210 testdeploy_20131216125545 testdeploy_20131216124120 testdeploy_20131216123755 testdeploy_20131213154139 testdeploy_20131211182716 testdeploy_20131211164231 testdeploy_20131125114006 testdeploy_20131125112212 testdeploy_20131125112125 testdeploy_20131125103758 testdeploy_20131120172438 testdeploy_20131120122741 testdeploy_20131119171800 testdeploy_20131115105918 testdeploy_20131114104933 testdeploy_20131113120139 testdeploy_20131112164713 testdeploy_20131112163844 testdeploy_20131112163647 testdeploy_20131112112117 testdeploy_20131111120055 testdeploy_20131108163238 testdeploy_20131106101343 testdeploy_20131105163657 testdeploy_20131105122859 testdeploy_20131029175605 testdeploy_20131029173341 testdeploy_20131029171340 publication_backend_2014.04.29.17.31.41 publication_backend_2014.04.29.17.24.51 publication_backend_2014.04.29.17.23.49 publication_backend_2014.04.23.14.20.27 publication_backend_2014.04.23.13.22.39 publication_backend_2014.04.23.10.35.34 publication_backend_2014.04.22.17.28.41 publication_backend_2014.04.22.17.23.18 publication_backend_2014.04.15.16.19.46 publication_backend_2014.04.15.15.59.20 publication_backend_2014.04.14.16.16.34 publication_backend_2014.04.14.16.05.13 publication_backend_2014.04.14.11.28.19 publication_backend_2014.04.14.11.21.54 publication_backend_2014.04.14.10.06.21 publication_backend_2014.04.14.09.59.28 publication_backend_2014.04.11.17.33.16 publication_backend_2014.04.11.16.21.20 publication_backend_2014.04.11.15.44.42
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.settings
elab4-backend-client
elab4-backend-configuration-example
elab4-backend
elab4-common
elab4-publication-backend
scripts
work
.gitignore
.project
LICENSE.txt
README.md
pom.xml

README.md

eLaborate (backend)

What is eLaborate?

eLaborate is an online work environment in which scholars can upload scans, transcribe and annotate text, and publish the results as on online text edition which is freely available to all users. eLaborate is developed by Huygens ING.

This project is the REST-based backend, which connects with database and SOLR index. It compiles to a webapp.

Installation

download the codebase

git clone https://github.com/HuygensING/elaborate4-backend.git

Set up the database

psql elaborate_projects < sql/schema.sql

Set up the solr webapp

http://wiki.apache.org/solr/SolrTomcat Use the config files in the solr/ directory.

Build the backend webapp

cd elab4
mvn install
cd elab4-backend
mvn -P example package

copy the .war in target/ to your tomcat's webapp directory

REST API

about

GET /about

returns the backend build version as JSON

example output:

{
  builddate: "Mon, Jan 27, 2014 11:59:00 AM",
  build: "20140127115900",
  version: "4.0"
}

sessions

To login as the root user with the default password: POST /sessions/login/

data to post: "username=root&password=toor"

All the following REST calls need and Authorization header. All POST/PUT calls accept and return JSON, unless otherwise specified.

users

  • Create: POST /users

    {
      "username" : "new_user",
      "email" : "new.user@huygens.knaw.nl",
      "firstName" : "New",
      "lastName" : "User",
      "role" : "USER",
      "password" : "laswysdfas23"
    }
    
  • Read: GET /users

  • Update: PUT /users/{user_id}

    {
      "email" : "new.user@example.org",
      "firstName" : "New",
      "lastName" : "User",
      "role" : "USER",
      "password" : "laswysdfas23"
    }
    
  • Delete: DELETE /users/{user_id}

  • request a password reset (sends email) POST /sessions/passwordresetrequest

    send the user's e-mail address as data, sends an email with a link to the password reset frontent page

  • reset password POST /sessions/passwordreset

    {
      "emailAddress" : "name@example.org",
      "newPassword" : "newpassword",
      "token" : "aasd13413as"
    }
    

    where token is the token given in the email

projectmetadata

  • Create: POST /projectmetadatafields

    {
      "fieldName" : "whatever"
    }
    
  • Read: all: GET /projectmetadatafields specific: GET /projectmetadatafields/{field_id}

  • Update: PUT /projectmetadatafields/{field_id}

    {
      "fieldName" : "new.field.name"
    }
    
  • Delete: DELETE /projectmetadatafields/{field_id}

annotation types

  • Create: POST /annotationtypes

    {
      "name" : "short_name"
      "description" : "Longer description"
    }
    
  • Read:

    all: GET /annotationtypes

    specific: GET /annotationtypes/{type_id}

  • Update: PUT /annotationtypes/{type_id}

    {
      "name" : "different_short_name"
      "description" : "Updated description"
    }
    
  • Delete: DELETE /annotationtypes/{type_id}

  • get metadata: GET /annotationtypes/{type_id}/metadataitems

  • add metadata: POST /annotationtypes/{type_id}/metadataitems/{meta_id}

    {
      "name" : "fieldname"
      "description" : "Description of the field"
    }
    
  • update metadata: PUT /annotationtypes/{type_id}/metadataitems/{meta_id}

    {
      "name" : "different fieldname"
      "description" : "Different description"
    }
    
  • delete metadata: DELETE /annotationtypes/{type_id}/metadataitems/{meta_id}

projects

  • Create: POST /projects

    {
      "title" : "project title",
      "textLayers" : [ "Diplomatic", "Critical", "Translation"]
    }
    
  • Read:

    all: GET /projects

    specific: GET /projects/{project_id}

  • Delete: DELETE /projects/{project_id}

project textlayers

  • update project textlayer settings: PUT /projects/{project_id}/textlayers

    [ "first","second","third" ]
    

project sorting/grouping levels

  • update project sorting/grouping levels: PUT /projects/{project_id}/sortlevels

    [ "level1","level2","level3" ]
    

project annotation types

  • Read: GET /projects/{project_id}/annotationtypes

  • Update: PUT /projects/{project_id}/annotationtypes

    [1,2,3]
    

project logentries

  • Read: GET /projects/{project_id}/logentries

project users

  • Read: GET /projects/{project_id}/projectusers gives an array of user ids

  • Update: PUT /projects/{project_id}/projectusers

    [1,2,3]
    

project settings

  • Read: GET /projects/{project_id}/settings

  • update project settings: PUT /projects/{project_id}/settings

    {
      "Type" : "Letter project",
      "Version" : "0.1"
    }
    

    extra system-defined project settings variables (optional):
    text.font - use when a special (unicode) font is necessary to display the textlayer texts. publication.title - use when the publication needs a different title from the title in the edit environment.

    entry.term_singular - the name used in this project to indicate a single entry (eg. 'letter') entry.term_plural - the name used in this project to indicate multiple entries (eg. 'letters')

    annotationtype.b.name - short name for the annotationtype to be displayed as bold for this project annotationtype.b.description - longer description for the annotationtype to be displayed as bold for this project annotationtype.i.name - short name for the annotationtype to be displayed as italic annotationtype.i.description - longer description for the annotationtype to be displayed as italic annotationtype.u.name - short name for the annotationtype to be displayed as underline annotationtype.u.description - longer description for the annotationtype to be displayed as underline annotationtype.strike.name - short name for the annotationtype to be displayed as strikethrough annotationtype.strike.description - longer description for the annotationtype to be displayed as strikethrough

project entry metadatafields

  • Read: GET /projects/{project_id}/entrymetadatafields

  • Update: PUT /projects/{project_id}/entrymetadatafields

    [ "field1", "field2" ]
    

project entries

  • all entries for this project: GET /projects/{project_id}/entries

entries

  • Create: POST /projects/{project_id}/entries

    {
      "name" : "project-unique name",
      "publishable" : false
    }
    

    publishable is optional, default is false;

  • Read: GET /projects/{project_id}/entries/{entry_id}

  • Update: PUT /projects/{project_id}/entries/{entry_id}

    {
      "name" : "project-unique name",
      "publishable" : true
    }
    

    publishable is optional

  • Delete: DELETE /projects/{project_id}/entries/{entry_id}

  • get previous/next entry ids: GET /projects/{project_id}/entries/{entry_id}/prevnext

    {
      "prev" : 1234,
      "next" : 1235
    }
    

    when prev=-1, entry {entry_id} is the first. when next=-1, entry {entry_id} is the last. The entry ids are sorted in alphabetical order using the contents of the metadata fields as defined in project.level1, project.level2 and project.level3, and the entryname.

  • Read entry settings: GET /projects/{project_id}/entries/{entry_id}/settings

  • entrysettings bijwerken: PUT /projects/{project_id}/entries/{entry_id}/settings

    {
      "key" : "value",
      ....
    }
    

    where the values are strings.

  • update multiple entrysettings: PUT /projects/{project_id}/multipleentrysettings

    {
      "projectEntryIds" : [1,2,3],
      "settings" : {
        "Publishable" : false,
        "field1" : "value1",
        "field2" : "value2",
        ....
      }
    }
    

    where the (selected) projectEntityIds are longs, settings is a hashmap, Publishable is a boolean, and all other values are strings.

  • all transcripties for this entry: GET /projects/{project_id}/entries/{entry_id}/transcriptions

facsimiles

  • Create: POST /projects/{project_id}/entries/{entry_id}/facsimiles

    {
      "name" : "page 1",
      "filename" : "00000001.jpg"
      "zoomableUrl" : "http://localhost:8080/jp2/13507286068671.jp2"
    }
    
  • Read: GET /projects/{project_id}/entries/{entry_id}/facsimiles/{facsimile_id}

  • Update: PUT /projects/{project_id}/entries/{entry_id}/facsimiles/{facsimile_id}

    {
      "name" : "pagina 1",
      "filename" : "00000001.jpg"
      "zoomableUrl" : "http://localhost:8080/jp2/13507286068671.jp2"
    }
    
  • Delete: DELETE /projects/{project_id}/entries/{entry_id}/facsimiles/{facsimile_id}

transcriptions

  • Create: POST /projects/{project_id}/entries/{entry_id}/transcriptions

    {
      "body": "transcription body",
      "textLayer": "Diplomatic",
    }
    
  • Read: GET /projects/{project_id}/entries/{entry_id}/transcriptions/{transcription_id}

    {
      "body": "transcription body",
      "textLayer": "Diplomatic",
      "id": 13413
    }
    
  • Update: PUT /projects/{project_id}/entries/{entry_id}/transcriptions/{transcription_id}

    {
      "body": "new body",
    }
    
  • Delete: DELETE /projects/{project_id}/entries/{entry_id}/transcriptions/{transcription_id}

  • all annotations for this transcription: GET /projects/{project_id}/entries/{entry_id}/transcriptions/{transcription_id}/annotations

annotations

  • Create: POST /projects/{project_id}/entries/{entry_id}/transcriptions/{transcription_id}/annotations

    {
      "body" : "the annotation body",
      "typeId" : 1
      "metadata" : {
         "field1" : "value1",
         "field2" : "value"
      }
    }
    

    where typeId is the id of the AnnotationType used, default is 1 metadata is a hashmap with values for the relevant fields defined by the AnnotationType

  • Read: GET /projects/{project_id}/entries/{entry_id}/transcriptions/{transcription_id}/annotations/{annotation_id}

  • Update: PUT /projects/{project_id}/entries/{entry_id}/transcriptions/{transcription_id}/annotations/{annotation_id}

    {
      "body" : "the annotation body",
      "typeId" : 1
      "metadata" : {
         "field1" : "value1",
         "field2" : "value"
      }
    }
    
  • Delete: DELETE /projects/{project_id}/entries/{entry_id}/transcriptions/{transcription_id}/annotations/{annotation_id}

search

  • Create: POST /projects/{project_id}/search

    {
      "term" : "*",
      "caseSensitive" : false,
      "fuzzy" : false,
      "searchInTranscriptions" : true,
      "textLayers" : [ ],
      "searchInAnnotations" : false,
      "resultFields" : ["Document title","Author(s)"],
      "sortParameters":[
      	    {"fieldname":"Language","direction":"desc"},
      	    {"fieldname":"Signature"},
      	    {"fieldname":"Notes"}
      	  ],
      "facetFields" : [ ],
      "facetInfoMap" : null,
      "orderLevels" : [ ],
      "level1Field" : "name",
      "level2Field" : "name",
      "level3Field" : "name",
      "textFieldsToSearch" : { },
      "facetValues" : [ ]
    }
    
  • Read: GET /projects/{project_id}/search/{search_id}

publish

The projectleader or admin user can publish a draft of the project via POST /projects/{project_id}/draft

You can POST some json settings:

{
  "projectEntryMetadataFields" : ["Page","Part"],
  "annotationTypeIds" : [1,2,3]
}

where projectEntryMetadataFields is an array of those metadata fields that should be included in the publication (as facets), in the given order. By default all metadata fields will be included, in the order set in the project.

annotationTypeIds is a list of ids of those annotationtypes that should be included in the publication. By default all annotationtypes will be included.

For the publication, the project metadata, and the entry content will be exported to json, the entry text will be indexed, and everything will be packaged into a war file that is deployed to the tomcat server. The post will start the publication process in the background, and return a Location header with a link to the progress of the publishing: a json map with the following keys:

  • id - the publication task id
  • done - boolean set to true when the publishing is finished.
  • fail - boolean set to true when the publishing has been cancelled due to an internal error, the cause will be logged in a logline.
  • url - the url where the publication can be seen once the publishing has finished successfully.
  • loglines - an array of log lines with timestamps, indicating the progress of the publishing process.

Only those entries that have publishable=true will be shown in the publication.

The publication has a search comparable to the backend, with the exception of the need to login, and to provide the projectId.

Last updated: 2014-03-27