API Creating a new subcorpus - czcorpus/kontext GitHub Wiki

HTTP API / Creating a new subcorpus

Request

  • URL: /subcorpus/create?format=json
  • HTTP Method: POST
  • content type: application/json

Body

{
  "corpname": "syn2015",
  "usesubcorp": null,
  "aligned_corpora": [],
  "subcname": "s2015-books",
  "description": null,
  "form_type": "tt-sel",
  "text_types": {
    "doc.medium": ["B: kniha"]
  },
  "within": [
    {
      "structure_name": "doc",
      "attribute_cql": "doc.medium=\"B: kniha\"",
      "negated": false
    }
  ],
  "cql": "[] within <doc medium = \"B: kniha\"/>"
}

Request body arguments

name required / default description
corpname :eight_spoked_asterisk: corpus that will be used to create new subcorpus
usesubcorp null subcorp id, used only when creating subcorpus from draft
aligned_corpora [] TODO
subcname :eight_spoked_asterisk: new subcorpus name
description null new subcorpus description
form_type :eight_spoked_asterisk: tt-sel|within|cql method used to create subcorpus
text_types required when form_type = tt-sel text types and their values defining new subcorpus
within required when form_type = within within query defining new subcorpus
cql required when form_type = cql cql query defining new subcorpus

Response

  • HTTP status: 200 OK (if without errors)
  • content type: application/json
{
  "processed_subc": [
    {
      "ident": "d9ec8608-42d9-4595-8280-3b7659b3d91b",
      "label": "syn2015/s2015-books",
      "status": "PENDING",
      "category": "subcorpus",
      "args": {
        "subcname": "s2015-books",
        "corpname": "syn2015"
      },
      "created": 1670582868.095303,
      "error": null,
      "url": null,
      "auto_redirect": null
    }
  ],
  "messages": []
}

Important entries

name description
processed_subc list of active asynchronous subcorpus jobs (small subcorpora will be done synchronously)