API (deprecated)
Generated with https://github.com/ICIJ/fluent-http-apigen
Table of Content
/api/key
Operation /api/keydescription
ApiResponse /api/keyresponseCode
Options /api/key/:userId
Operation /api/keydescription
ApiResponse /api/keyresponseCode
Put /api/key/:userId
Operation /api/keydescription
ApiResponse /api/keyresponseCode
Get /api/key/:userId
Operation /api/keydescription
ApiResponse /api/keyresponseCode
Delete /api/key/:userId
/api/batch
Get /api/batch/search
Retrieve the batch search list for the user issuing the request.
Return 200 and the list of batch searches
Example :
Post /api/batch/search
Retrieve the batch search list for the user issuing the request filter with the given criteria, and the total of batch searches matching the criteria.
It needs a Query json body with the parameters :
from : index offset of the first document to return (mandatory)
size : window size of the results (mandatory)
sort : field to sort (prj_id name user_id description state batch_date batch_results published) (default "batch_date")
order : "asc" or "desc" (default "asc")
project : projects to include in the filter (default null / empty list)
batchDate : batch search with a creation date included in this range (default null / empty list)
state : states to include in the filter (default null / empty list)
publishState : publish state to filter (default null)
If from/size are not given their default values are 0, meaning that all the results are returned. BatchDate must be a list of 2 items (the first one for the starting date and the second one for the ending date) If defined publishState is a string equals to "0" or "1"
Return 200 and the list of batch searches with the total batch searches for the query. See example for the JSON format.
Example :
Get /api/batch/search/:batchid
Retrieve the batch search with the given id The query param "withQueries" accepts a boolean value When "withQueries" is set to false, the list of queries is empty and nbQueries contains the number of queries.
Parameter batchId
Return 200 and the batch search
Example :
Get /api/batch/search/:batchid/queries
Retrieve the batch search queries with the given batch id and returns a list of strings UTF-8 encoded
if the request parameter format is set with csv, then it will answer with content-disposition attachment (file downloading)
the optional request parameters are :
from: if not provided it starts from 0
size: if not provided all queries are returned from the "from" parameter
search: if provided it will filter the queries accordingly
orderBy: field name to order by asc, "query_number" by default (if it does not exist it will return a 500 error)
maxResult: number of maximum results for each returned query (-1 means no maxResults)
Parameter batchId
Return 200 and the batch search queries map [(query, nbResults), ...]
Example :
Options /api/batch/search
preflight request
Return 200 DELETE
Options /api/batch/search/:batchid
preflight resquest for removal of one batchsearch
Parameter batchId
Return 200 DELETE
Delete /api/batch/search/:batchid
Delete batch search with the given id and its results. It won't delete running batch searches, because results are added and would be orphans.
Returns 204 (No Content) : idempotent
Return 204
Example :
Patch /api/batch/search/:batchid
Update batch search with the given id.
Returns 200 and 404 if there is no batch id If the user issuing the request is not the same as the batch owner in database, it will do nothing (thus returning 404)
Return 200 or 404
Example :
Post /api/batch/search/:coma
Creates a new batch search. This is a multipart form with 8 fields : name, description, csvFile, published, fileTypes, paths, fuzziness, phrase_matches
No matter the order. The name and csv file are mandatory else it will return 400 (bad request) Csv file must have under 60 000 lines else it will return 413 (payload too large) Queries with less than two characters are filtered
To do so with bash you can create a text file like :
Then replace with with a sed like this:
sed -i 's/$/^M/g' ~/multipart.txt
Then make a curl request with this file :
Parameter comaSeparatedProjects
Parameter context : the request body
Return 200 or 400 or 413
Options /api/batch/search/copy/:sourcebatchid
preflight request
Return 200 POST
Post /api/batch/search/copy/:sourcebatchid
Create a new batch search based on a previous one given its id, and enqueue it for running
it returns 404 if the source BatchSearch object is not found in the repository.
Parameter sourceBatchId: the id of BatchSearch to copy
Parameter context : the context of request (containing body)
Return 200 or 404
Example:
Post /api/batch/search/result/:batchid
Retrieve the results of a batch search as JSON.
It needs a Query json body with the parameters :
from : index offset of the first document to return (mandatory)
size : window size of the results (mandatory)
queries: list of queries to be downloaded (default null)
sort: field to sort ("doc_nb", "doc_id", "root_id", "doc_path", "creation_date", "content_type", "content_length", "creation_date") (default "doc_nb")
order: "asc" or "desc" (default "asc")
If from/size are not given their default values are 0, meaning that all the results are returned.
Parameter batchId
Parameter webQuery
Return 200
Example :
Get /api/batch/search/result/csv/:batchid
Retrieve the results of a batch search as a CSV file.
The search request is by default all results of the batch search.
Parameter batchId
Return 200 and the CSV file as attached file
Example :
Delete /api/batch/search
Delete batch searches and results for the current user.
Returns 204 (No Content): idempotent
Return 204
Example :
/api
Get /api/:project/documents/src/:id?routing=:routing
Returns the file from the index with the index id and the root document (if embedded document).
The routing can be omitted if it is a top level document, or it can be the same as the id.
Returns 404 if it doesn't exist
Returns 403 if the user has no access to the requested index.
Parameter project
Parameter id
Parameter routing
Return 200 or 404 or 403 (Forbidden)
Example :
Get /api/:project/documents/content/:id?routing=:routing
Fetch extracted text by slice (pagination)
Parameter project Project id
Parameter id Document id
Parameter offset Starting byte (starts at 0)
Parameter limit Size of the extracted text slice in bytes
Parameter targetLanguage Target language (like "ENGLISH") to get slice from translated content
Return 200 and a JSON containing the extracted text content ("content":text), the max offset as last rank index ("maxOffset":number), start ("start":number) and size ("size":number) parameters.
Throws IOException
Example :
Get /api/:project/documents/searchContent/:id?routing=:routing
Search query occurrences in content or translated content (pagination)
Parameter project Project id
Parameter id Document id
Parameter query Query string to search occurrences (starts at 0)
Parameter targetLanguage Target language (like "ENGLISH") to search in translated content
Return 200 and a JSON containing the occurrences offsets in the text, and the count of occurrences.
Throws IOException
Example :
Post /api/:project/documents/batchUpdate/star
Group star the documents. The id list is passed in the request body as a json list.
It answers 200 if the change has been done and the number of documents updated in the response body.
Parameter projectId
Parameter docIds as json
Return 200 and the number of documents updated
Example :
Post /api/:project/documents/batchUpdate/unstar
Group unstar the documents. The id list is passed in the request body as a json list.
It answers 200 if the change has been done and the number of documents updated in the response body.
Parameter projectId
Parameter docIds as json in body
Return 200 and the number of documents unstarred
Example :
Get /api/:project/documents/starred
Retrieves the list of starred document for a given project.
Parameter projectId
Return 200
Example :
Get /api/:projects/documents/tagged/:coma
Retrieves the list of tagged document with tag "tag" for the given project id.
This service doesn't need to have the document stored in the database (no join is made)
Parameter projectId
Parameter comaSeparatedTags
Return 200
Example :
Options /api/:project/documents/tags/:docId
preflight request
Parameter projectId
Parameter docId
Return 200 PUT
Put /api/:project/documents/tags/:docId?routing=:routing
Parameter projectId
Parameter docId
Parameter routing
Parameter tags
Return 201 if created else 200
Example :
Get /api/:project/documents/tags/:docId
Gets all the tags from a document with the user and timestamp.
Parameter projectId
Parameter docId
Return 200 and the list of tags
Example :
Post /api/:project/documents/batchUpdate/tag
Group tag the documents. The document id list and the tag list are passed in the request body.
It answers 200 if the change has been done.
Parameter projectId
Parameter query
Return 200
Example :
Post /api/:project/documents/batchUpdate/untag
Group untag the documents. The document id list and the tag list are passed in the request body.
It answers 200 if the change has been done.
Parameter projectId
Parameter query
Return 200
Example :
Options /api/:project/documents/untag/:docId
preflight request
Parameter projectId
Parameter docId
Return 200 PUT
Put /api/:project/documents/untag/:docId?routing=:routing
Untag one document
Parameter projectId
Parameter docId
Parameter routing
Parameter tags
Return 201 if untagged else 200
Get /api/documents/starred
Retrieves the list of starred document for all projects.
This service needs to have the document stored in the database.
Return 200 and the list of Documents
Get /api/users/recommendations?project=:project
Retrieves the list of users who recommended a document with the total count of recommended documents for the given project id
Parameter projectId
Return 200
Example :
Get /api/users/recommendationsby?project=:project
Get all users who recommended a document with the count of all recommended documents for project and documents ids.
Parameter projectId
Parameter comaSeparatedDocIds
Return 200 and the list of tags
Example :
Get /api/:project/documents/recommendations?userids=:coma
Retrieves the set of marked read documents for the given project id and a list of users provided in the url.
This service doesn't need to have the document stored in the database (no join is made)
Parameter projectId
Parameter comaSeparatedUsers
Return 200
Example :
Post /api/:project/documents/batchUpdate/recommend
Group mark the documents "read". The id list is passed in the request body as a json list.
It answers 200 if the change has been done and the number of documents updated in the response body.
Parameter projectId
Parameter docIds as json
Return 200 and the number of documents marked
Example :
Post /api/:project/documents/batchUpdate/unrecommend
Group unmark the documents. The id list is passed in the request body as a json list.
It answers 200 if the change has been done and the number of documents updated in the response body.
Parameter projectId
Parameter docIds as json
Return 200 and the number of documents unmarked
Example :
/api/extensions
Get /api/extensions
Gets the extension set in JSON
If a request parameter "filter" is provided, the regular expression will be applied to the list.
see https://docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html for pattern syntax.
Example:
Return
Options /api/extensions/install
Preflight request
Return OPTIONS,PUT
Put /api/extensions/install
Download (if necessary) and install extension specified by its id or url
request parameter id
or url
must be present.
Return 200 if the extension is installed
Return 404 if the extension is not found by the provided id or url
Return 400 if neither id nor url is provided
Throws IOException
Example:
Options /api/extensions/uninstall
Preflight request
Return OPTIONS,DELETE
Delete /api/extensions/uninstall?id=:extensionId
Uninstall extension specified by its id
Parameter extensionId
Return 204 if the extension is uninstalled (idempotent)
Throws IOException if there is a filesystem error
Example:
/api/index
Put /api/index/:index
Create the index for the current user if it doesn't exist.
Return 201 (Created) or 200 if it already exists
Example :
Options /api/index/:index
Preflight for index creation.
Parameter index
Return 200 with PUT
Head /api/index/search/:path:
Head request useful for JS api (for example to test if an index exists)
Parameter path
Return 200
Post /api/index/search/:path:
The search endpoint is just a proxy in front of Elasticsearch, everything sent is forwarded to Elasticsearch. DELETE method is not allowed.
Path can be of the form :
_search/scroll
index_name/_search
index_name1,index_name2/_search
index_name/_count
index_name1,index_name2/_count
index_name/doc/_search
index_name1,index_name2/doc/_search
Parameter path
Return 200 or http error from Elasticsearch
Example :
Get /api/index/search/:path:
Search GET request to Elasticsearch
As it is a GET method, all paths are accepted.
if a body is provided, the body will be sent to ES as source=urlencoded(body)&source_content_type=application%2Fjson in that case, request parameters are not taken into account.
Parameter path
Return 200 or http error from Elasticsearch
Example :
Options /api/index/search/:path:
Prefligth option request
Parameter path
Return 200
/api
Get /api/:project/namedEntities/:id?routing=:documentId
Returns the named entity with given id and document id.
Parameter id
Parameter documentId the root document
Return 200
Example :
Options /api/:project/namedEntities/hide/:mentionNorm
preflight request for hide
Parameter mentionNorm
Return 200 PUT
Put /api/:project/namedEntities/hide/:mentionNorm
hide all named entities with the given normalized mention
Parameter mentionNorm
Parameter project
Return 200
Example :
/api/ner
Get /api/ner/pipelines
Get the list of registered pipelines.
Return pipeline set Example:
Post /api/ner/findNames/:pipeline
When datashare is launched in NER mode (without index) it exposes a name finding HTTP API. The text is sent with the HTTP body.
Parameter pipeline to use
Parameter text to analyse in the request body
Return list of NamedEntities annotations
Example :
/api
Get /api/:project/notes/:path:
Gets the list of notes for a project and a document path.
if we have on disk:
And in database
p1
a
note A
info
p1
a/b
note B
danger
then :
GET /api/p1/notes/a/b/doc1
will return note A and BGET /api/p1/notes/a/c/doc2
will return note AGET /api/p1/notes/d/doc3
will return an empty list
If the user doesn't have access to the project she gets a 403 Forbidden
Parameter project the project the note belongs to
Parameter documentPath the document path
Parameter context HTTP context containing the user
Return list of Note that match the document path
Example:
Get /api/:project/notes
Gets the list of notes for a project.
If the user doesn't have access to the project she gets a 403 Forbidden
Parameter project the project the note belongs to
Parameter context HTTP context containing the user
Return list of Note related to the project
Example:
/api/openapi
Operation /api/openapidescription
ApiResponse /api/openapiresponseCode
Get /api/openapi
/api/plugins
Get /api/plugins
Gets the plugins set in JSON
If a request parameter "filter" is provided, the regular expression will be applied to the list.
see https://docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html for pattern syntax.
Example:
Options /api/plugins/install
Preflight request
Return OPTIONS,PUT
Put /api/plugins/install
Download (if necessary) and install plugin specified by its id or url
request parameter id
or url
must be present.
Return 200 if the plugin is installed
Return 404 if the plugin is not found by the provided id or url
Return 400 if neither id nor url is provided
Throws IOException
Throws ArchiveException
Example:
Options /api/plugins/uninstall
Preflight request
Return OPTIONS,DELETE
Delete /api/plugins/uninstall?id=:pluginId
Uninstall plugin specified by its id Always returns 204 or error 500.
Parameter pluginId
Return 204
Throws IOException if there is a filesystem error
Example:
/api/project
Get /api/project/
Post /api/project/
Put /api/project/:id
Get /api/project/:id
Gets the project information for the given project id.
Parameter id
Return 200 and the project from database if it exists
Example :
``` curl -H 'Content-Type:application/json' localhost:8080/api/project/apigen-datashare {"error":"java.lang.NullPointerException"} ``` ) ##Get /api/project/isDownloadAllowed/:id Returns if the project is allowed with this network route : in datashare database there is the project table that can specify an IP mask that is allowed per project. If the client IP is not in the range, then the file download will be forbidden.
in that project table there is a field called allow_from_mask
that can have a mask with IP and star wildcard.
Ex : 192.168.*.*
will match all subnetwork 192.168.0.0 IP's and only users with an IP in this range will be granted for downloading documents.
Parameter id
Return 200 or 403 (Forbidden)
Example :
Example :
Options /api/project/:id
Preflight option request
Parameter id
Return 200 DELETE
Delete /api/project/:id
Delete the project from database and elasticsearch indices.
It always returns 204 (no content) or 500 if an error occurs.
If the project id is not the current user project (local-datashare in local mode), then it will return 401 (unauthorized)
Parameter id
Return 204
Example :
/
Get /
gets the root of the front-end app ie: ./app/index.html
if pluginsDir is set, it will add in the index the tag else it will return the index.html content as is
Return the content of index.html file
Get /settings
Gets the public (i.e. without user's information) datashare settings parameters. These parameters are used for the client app for the init process.
The endpoint is removing all fields that contain Address or Secret or Url or Key
Return 200
Example :
Get /version
Gets the versions (front/back/docker) of datashare.
Return 200
Example :
/api/settings
Options /api/settings
Preflight for settings.
Parameter context
Return 200 with PATCH
Patch /api/settings
update the datashare settings with provided body. It will save the settings on disk.
Returns 404 if settings is not found. It means that the settings file has not been set (or is not readable) Returns 403 if we are in SERVER mode
The settings priority is basically DS_DOCKER_* variables > -s file > classpath:datashare.properties > command line. I.e. :
DS_DOCKER_* variables will be taken and override all keys (if any similar keys exist)
if a file is given (w/ -c path/to/file) to the command line it will be read and used (it can be empty or not present)
if no file is given, we are looking for datashare.properties in the classpath (for example in /dist)
if none of the two above cases is fulfilled we are taking the default CLI parameters (and those given by the user)
parameters are common between CLI and settings file, the settings file "wins"
if a settings file is not writable then 404 will be returned (and a WARN will be logged at start)
Return 200 or 404 or 403
Example :
Get /api/settings/ocr/languages
List all available language in Tesseract
Returns 503 if Tesseract is not installed
Return 200 or 503
Get /api/settings/text/languages
List all available language in the text extractor
Return 200
/api
Get /api/status
Retrieve the status of databus connection, database connection, shared queues and index. Adding "format=openmetrics" parameter to the url will return the status witn openmetrics format.
Return the status of datashare elements
Example:
/api/task
Get /api/task/all
gets all the user tasks a filter can be added with a pattern contained in the task name.
Return 200 and the list of tasks
Example :
Get /api/task/:id
gets one task with its id
Parameter id
Return 200
Example :
Get /api/task/:id/result
gets task result with its id
Parameter id
Return 200 and the result, 204 if there is no result 404 if the tasks doesn't exist 403 if the task is not belonging to current user
Example :
Options /api/task/batchDownload
Post /api/task/batchDownload
download files from a search query. Expected parameters are :
project: string
query: string or elasticsearch JSON query
if the query is a string it is taken as an ES query string, else it is a raw JSON query (without the query part) @see org.elasticsearch.index.query.WrapperQueryBuilder that is used to wrap the query
Parameter optionsWrapper wrapper for options json
Return 200 and json task
Example :
Post /api/task/batchUpdate/index
index files from the queue
Parameter optionsWrapper wrapper for options json
Return 200 and json task
Example :
Post /api/task/batchUpdate/index/file
Indexes files in a directory (with docker, it is the mounted directory that is scanned)
Parameter optionsWrapper
Return 200 and the list of tasks created
Example :
Post /api/task/batchUpdate/index/:filePath:
Indexes all files of a directory with the given path.
Parameter filePath
Parameter optionsWrapper
Return 200 and the list of created tasks
Example $(curl -XPOST localhost:8080/api/task/batchUpdate/index/home/dev/myfile.txt)
Post /api/task/batchUpdate/scan/:filePath:
Scans recursively a directory with the given path
Parameter filePath
Parameter optionsWrapper
Return 200 and the task created
Example :
Post /api/task/clean
Cleans all DONE tasks.
Return 200 and the list of removed tasks
Example :
Delete /api/task/clean/:taskName:
Cleans a specific task.
Parameter taskName
Return
Example :
Options /api/task/clean/:taskName:
Put /api/task/stop/:taskId:
Cancels the task with the given name. It answers 200 with the cancellation status true|false
Parameter taskId
Return
Options /api/task/stop/:taskName:
Put /api/task/stopAll
Cancels the running tasks. It returns a map with task name/stop statuses. If the status is false, it means that the thread has not been stopped.
Return 200 and the tasks stop result map
Example : curl -XPUT localhost:8080/api/task/stopAll
Options /api/task/stopAll
Post /api/task/findNames/:pipeline
Find names using the given pipeline :
OPENNLP
CORENLP
IXAPIPE
GATENLP
MITIE
This endpoint is going to find all Documents that are not taggued with the given pipeline, and extract named entities for all these documents.
Parameter pipelineName
Parameter optionsWrapper
Return 200 and the list of created tasks
Example :
/api/tree
Get /api/tree:dirPath:
List all files and directory for the given path. This endpoint returns a JSON using the same specification than the tree
command on UNIX. It is roughly the equivalent of:
Parameter dirPath
Return 200 and the list of files and directory
Example $(curl -XGET localhost:8080/api/tree/home/datashare/data)
/api/users
Get /api/users/me
Gets the user's session information
Return 200 and the user map
Example :
Options /api/users/me/history
Preflight for history.
Return 200 with OPTIONS, GET, PUT and DELETE
Get /api/users/me/history?type=:type
Gets the user's history by type
Parameter type String included in 'document' or 'search'
Parameter from the offset of the list, starting from 0
Parameter size the number of element retrieved
Parameter sort the name of the parameter to sort on (default: modificationDate)
Parameter desc the list is sorted in descending order (default: true)
Parameter projects projectIds separated by comma to filter by projects (default: none)
Return 200, the user's list of events and the total number of events
Example : ``` curl -i localhost:8080/api/users/me/history?type=document&from=0&size=10&sort=modificationDate&desc=true&projects=project1,project2 HTTP/1.1 200 OK Access-Control-Allow-Origin: * Content-Type: application/json;charset=UTF-8 ETag: 9a3f093e2dc5d929bb25879501d527c7 Content-Length: 22 Connection: keep-alive Set-Cookie: _ds_session_id={"login":null,"roles":null,"sessionId":null,"redirectAfterLogin":"/"}; version=1; path=/; expires=Mon, 30-Jul-2091 14:00:32 GMT; max-age=2147483647
{"items":[],"total":0}
curl -i -XPUT -H "Content-Type: application/json" localhost:8080/api/users/me/history -d '{"type": "SEARCH", "projectIds": ["apigen-datashare","local-datashare"], "name": "foo AND bar", "uri": "?q=foo%20AND%20bar&from=0&size=100&sort=relevance&index=luxleaks&field=all&stamp=cotgpe"}' HTTP/1.1 500 Internal Server Error Content-Type: application/json;charset=UTF-8 ETag: b1b6023e69d8821fc4e1e8418ab85f30 Content-Length: 77 Connection: keep-alive
{"error":"org.jooq.exception.DataAccessException: Cannot commit transaction"}
curl -i -XDELETE localhost:8080/api/users/me/history?type=search HTTP/1.1 500 Internal Server Error Content-Type: application/json;charset=UTF-8 ETag: b1b6023e69d8821fc4e1e8418ab85f30 Content-Length: 77 Connection: keep-alive
{"error":"org.jooq.exception.DataAccessException: Cannot commit transaction"}
curl -i -XDELETE localhost:8080/api/users/me/history/event?id=1 HTTP/1.1 500 Internal Server Error Content-Type: application/json;charset=UTF-8 ETag: b1b6023e69d8821fc4e1e8418ab85f30 Content-Length: 77 Connection: keep-alive
{"error":"org.jooq.exception.DataAccessException: Cannot commit transaction"}
Last updated