Skip to content

Service: Virtual Corpus List (System Admin)

Eliza Margaretha edited this page Mar 13, 2023 · 15 revisions

** WARNING: This service is experimental and may change without any notice.

Lists virtual corpora by creator and type. This service is limited for system admins. If type is not specified, retrieves virtual corpora of all types. If createdBy is not specified, retrieves virtual corpora of all users.

This service requires admin authentication either by using the Authorization header or including an admin token in the request body. At server starts-up, Kustvakt automatically generates an adminToken file at the root project folder, if it has not existed already.

Available in: full version

Method: POST

Service URL: root/admin/vc/list

Parameters

Header Parameter

Name Required Authentication scheme Value
Authorization yes Bearer OAuth2 access token
Basic (for testing only) username and password encoded in Base64
Content-Type yes content type of the input data application/x-www-form-urlencoded

Query Parameters

Name Required Description Type Value
createdBy no virtual corpus creator String a username
type no virtual corpus type VirtualCorpusType SYSTEM, PROJECT, PRIVATE, PUBLISHED

Examples

Request with admin token

Run the command on the root folder containing an adminToken file:

curl -v -H 'Content-Type: application/x-www-form-urlencoded'  \
     -d @adminToken \
     'http://localhost:8089/api/v1.0/admin/vc/list'

or describe an adminToken explicitly in the command:

curl -v -H 'Content-Type: application/x-www-form-urlencoded'  \
     -d 'token=Rn8zb30nkqVlHd_Wxt2DpE' \
     'http://localhost:8089/api/v1.0/admin/vc/list'

Request with cURL

curl -v -H 'Content-Type: application/x-www-form-urlencoded' \
     -H 'Authorization: Bearer f70p9lBCIufy_9LYEef2jQzJLlBMpc1egkv4dCBxcD3A' 
     -X POST \
     'http://localhost:8089/api/v1.0/admin/vc/list?createdBy=dory&type=PROJECT'

Request with Basic authentication (for testing only)

curl -H 'Authorization: Basic YWRtaW46cGFzc3dvcmQ=' \
     -X POST \
     'http://localhost:8089/api/v1.0/admin/vc/list?createdBy=dory&type=PROJECT'

Output example:

[{
    "id": 2,
    "name": "group-vc",
    "type": "project",
    "status": "experimental",
    "description": "test vc",
    "requiredAccess": "PUB",
    "createdBy": "dory",
    "numberOfDoc": 4,
    "numberOfParagraphs": 283,
    "numberOfSentences": 14027,
    "numberOfTokens": 386440,
    "koralQuery": "{"collection": { "@type": "koral:docGroup", "operands": 
    [ { "@type": "koral:doc", "key": "corpusSigle", "match": "match:eq", 
    "value": "GOE" }, { "@type": "koral:doc", "key": "creationDate", 
    "match": "match:leq", "type": "type:date", "value": "1810" } ], 
    "operation": "operation:and" }}"
}]

Clone this wiki locally