ImportResource Resource

Resource class for import endpoints.

POST /import/coreferences

Link items in a scope via an access point coreference table.

Each data row must consist of 2 columns:

  1. the access point label (text string)
  2. the target item ID

A single log item will be created for the entire CSV.

Request Parameters
name type description default constraints
commit query actually change the graph false boolean
scope query the id of the permission scope item    
tolerant query don't abort on the first error false boolean
Request Body
media type data type description
application/json (custom) the tabular data
text/csv (custom)
Response Body
media type data type description
application/json (custom) an import log

Example

Request
POST /import/coreferences
Content-Type: application/json
Accept: application/json

                
...
                
              
Response
HTTP/1.1 201 Created
Content-Type: application/json

                
...
                
              

POST /import/csv

Request Parameters
name type description default constraints
allow-update query false boolean
commit query false boolean
importer query    
lang query eng  
log query    
scope query    
tag query -  
tolerant query false boolean
Request Body
media type data type
application/json (custom)
application/octet-stream (custom)
text/csv (custom)
text/plain (custom)
Response Body
media type data type description
application/json (custom)

Example

Request
POST /import/csv
Content-Type: application/json
Accept: application/json

                
...
                
              
Response
HTTP/1.1 201 Created
Content-Type: application/json

                
...
                
              

POST /import/eac

Request Parameters
name type description default constraints
allow-update query false boolean
commit query false boolean
handler query    
importer query    
lang query lang  
log query    
properties query    
scope query    
tag query -  
tolerant query false boolean
Request Body
media type data type
application/json (custom)
application/octet-stream (custom)
application/xml (custom)
text/plain (custom)
text/xml (custom)
Response Body
media type data type description
*/* (custom)

Example

Request
POST /import/eac
Content-Type: application/json
Accept: */*

                
...
                
              
Response
HTTP/1.1 201 Created
Content-Type: */*

                
...
                
              

POST /import/ead

Import a set of EAD files. The POST body can be one of:

  • a single EAD file
  • multiple EAD files in an archive such as tar, tar.gz, or zip
  • a plain test file containing local file paths
  • a JSON object consisting of file-name/URL pairs
The Content-Type header is used to distinguish the contents.

The way you would run with would typically be:

    
     curl -X POST \
      -H "X-User: mike" \
      --data-binary @ead-list.txt \
      "http://localhost:7474/ehri/import/ead?scope=my-repo-id&log=testing&tolerant=true"

 # NB: Data is sent using --data-binary to preserve line-breaks - otherwise
 # it needs url encoding.
    
 

(Assuming ead-list.txt is a list of newline separated EAD file paths.)

(TODO: Might be better to use a different way of encoding the local file paths...)

Request Parameters
name type description default constraints
allow-update query allow the importer to update items that already exist. If it attempts to do so without this option enabled an error will be thrown false boolean
commit query commit the operation to the database. The default mode is to operate as a dry-run false boolean
handler query the fully-qualified handler class name (defaults to EadHandler)    
importer query the fully-qualified import class name (defaults to EadImporter)    
lang query the default description language, if not inferrable from the data eng  
log query log message for import. If this refers to an accessible local file its contents will be used.    
properties query a local file path or URL pointing to an import properties configuration file.    
scope query the id of the import scope (i.e. repository)    
tag query if the data is a stream of XML a string "tag" can be provided to identify the source, e.g. the name of the file from which the stream derives. If a tag is not provided, or the input data is not an XML stream, the default value of "-" will be used -  
tolerant query whether or not to die on the first validation error false boolean
use-source-id query by default a description will update an existing description if it has the same language code. Setting this option to 'true' allows adding multiple descriptions in the same language by taking into account the value of the EAD ID. false boolean
Request Body
media type data type description
application/json (custom) file data containing one of: a single EAD file, multiple EAD files in an archive, a list of file URLs. The Content-Type header is used to distinguish the contents.
application/octet-stream (custom)
application/xml (custom)
text/plain (custom)
text/xml (custom)
Response Body
media type data type description
*/* (custom) a JSON object showing how many records were created, updated, or unchanged.

Example

Request
POST /import/ead
Content-Type: application/json
Accept: */*

                
...
                
              
Response
HTTP/1.1 201 Created
Content-Type: */*

                
...
                
              

POST /import/ead-sync

Synchronise a repository or fonds via EAD data, removing items which are not present in the incoming data. Parameters are the same as /ead with the addition of `ex={id}`, which allows specifying items to ignore, and fondsId, which allows synchronising just within a specific item.

Request Parameters
name type description default constraints multivalued
allow-update query allow the importer to update items that already exist. If it attempts to do so without this option enabled an error will be thrown false boolean no
commit query commit the operation to the database. The default mode is to operate as a dry-run false boolean no
ex query the ID of an item to be excluded from the sync operation     yes
fonds query the ID of a specific fonds within the repository scope to synchronise. If missing the scope will be used     no
handler query the fully-qualified handler class name (defaults to EadHandler)     no
importer query the fully-qualified import class name (defaults to EadImporter)     no
lang query the default description language, if not inferrable from the data eng   no
log query log message for import. If this refers to an accessible local file its contents will be used.     no
properties query a local file path or URL pointing to an import properties configuration file.     no
scope query the id of the import scope (i.e. repository)     no
tag query if the data is a stream of XML a string "tag" can be provided to identify the source, e.g. the name of the file from which the stream derives. If a tag is not provided, or the input data is not an XML stream, the default value of "-" will be used -   no
tolerant query whether or not to die on the first validation error false boolean no
use-source-id query by default a description will update an existing description if it has the same language code. Setting this option to 'true' allows adding multiple descriptions in the same language by taking into account the value of the EAD ID. false boolean no
Request Body
media type data type description
application/json (custom) file data containing one of: a single EAD file, multiple EAD files in an archive, a list of file URLs. The Content-Type header is used to distinguish the contents.
application/octet-stream (custom)
application/xml (custom)
text/plain (custom)
text/xml (custom)
Response Body
media type data type description
*/* (custom) a SyncLog instance.

Example

Request
POST /import/ead-sync
Content-Type: application/json
Accept: */*

                
...
                
              
Response
HTTP/1.1 201 Created
Content-Type: */*

                
...
                
              

POST /import/eag

Request Parameters
name type description default constraints
allow-update query false boolean
commit query false boolean
handler query    
importer query    
lang query lang  
log query    
properties query    
scope query    
tag query -  
tolerant query false boolean
Request Body
media type data type
application/json (custom)
application/octet-stream (custom)
application/xml (custom)
text/plain (custom)
text/xml (custom)
Response Body
media type data type description
*/* (custom)

Example

Request
POST /import/eag
Content-Type: application/json
Accept: */*

                
...
                
              
Response
HTTP/1.1 201 Created
Content-Type: */*

                
...
                
              

POST /import/links

Create multiple links via CSV or JSON tabular upload.

Each data row must consist of 6 columns:

  1. the source item ID
  2. the target item ID
  3. the access point ID (optional)
  4. the link type, e.g. associative, hierarchical
  5. the link field (if applicable) e.g. relatedUnitsOfDescription
  6. the link description (optional)

A single log item will be created for the entire CSV.

Request Parameters
name type description default constraints
commit query actually change the graph false boolean
tolerant query don't abort on the first error false boolean
Request Body
media type data type description
application/json (custom) the tabular data
text/csv (custom)
Response Body
media type data type description
application/json (custom) an import log

Example

Request
POST /import/links
Content-Type: application/json
Accept: application/json

                
...
                
              
Response
HTTP/1.1 201 Created
Content-Type: application/json

                
...
                
              

POST /import/skos

Import a SKOS file, of varying formats, as specified by the "language" column of the file extensions table here.

Example:

    
 curl -X POST \
      -H "X-User: mike" \
      --data-binary @skos-data.rdf \
      "http://localhost:7474/ehri/import/skos?scope=gb-my-vocabulary&log=testing&tolerant=true"
     
 

Request Parameters
name type description default constraints
allow-update query allow the operation to update existing items false boolean
baseURI query a URI prefix common to ingested items that will be removed from each item's URI to obtain the local identifier.    
commit query commit the operation to the database. The default mode is to operate as a dry-run false boolean
format query the RDF format of the POSTed data    
lang query the default language of description fields if not inferrable the data eng  
log query log message for import. If this refers to an accessible local file its contents will be used.    
scope query the id of the import scope (i.e. repository)    
suffix query a URI suffix common to ingested items that will be removed from each item's URI to obtain the local identifier.    
tolerant query whether or not to die on the first validation error false boolean
Request Body
media type data type description
*/* (custom) a stream of SKOS data in a valid format.
Response Body
media type data type description
*/* (custom) a JSON object showing how many records were created, updated, or unchanged.

Example

Request
POST /import/skos
Content-Type: */*
Accept: */*

                
...
                
              
Response
HTTP/1.1 201 Created
Content-Type: */*

                
...