margaretha | 823d756 | 2024-03-19 11:21:04 +0100 | [diff] [blame] | 1 | { |
| 2 | "openapi": "3.0.3", |
| 3 | "info": { |
| 4 | "title": "Kustvakt - OpenAPI 3.0", |
| 5 | "description": "Kustvakt server is a user and policy management component for KorAP, capable of rewriting queries for policy based document restrictions.", |
| 6 | "license": { |
| 7 | "name": "BSD-2 License", |
| 8 | "url": "https://raw.githubusercontent.com/KorAP/Kustvakt/master/LICENSE" |
| 9 | }, |
| 10 | "version": "1.0.11" |
| 11 | }, |
| 12 | "externalDocs": { |
| 13 | "description": "Kustvakt on Github", |
| 14 | "url": "https://github.com/KorAP/Kustvakt" |
| 15 | }, |
| 16 | "servers": [ |
| 17 | { |
| 18 | "url": "https://korap.ids-mannheim.de/api/v1.0" |
| 19 | } |
| 20 | ], |
| 21 | "tags": [ |
| 22 | { |
| 23 | "name": "search", |
| 24 | "externalDocs": { |
| 25 | "description": "More documentation", |
| 26 | "url": "https://github.com/KorAP/Kustvakt/wiki/" |
| 27 | } |
| 28 | } |
| 29 | ], |
| 30 | "paths": { |
| 31 | "/search": { |
| 32 | "get": { |
| 33 | "tags": [ |
| 34 | "search" |
| 35 | ], |
| 36 | "summary": "Search the given query over all corpora or a virtual corpus.", |
| 37 | "description": "Returns query results according to the given parameters. Without authorization, it is possible to search only metadata of all corpora by setting access-rewrite-disabled=true.", |
| 38 | "operationId": "search", |
| 39 | "security": [ |
| 40 | { |
| 41 | "main_instance_authentication": [ |
| 42 | "search" |
| 43 | ] |
| 44 | }, |
| 45 | { |
| 46 | "test_instance_authentication": [ |
| 47 | "search" |
| 48 | ] |
| 49 | } |
| 50 | ], |
| 51 | "parameters": [ |
| 52 | { |
| 53 | "name": "q", |
| 54 | "in": "query", |
| 55 | "required": true, |
| 56 | "description": "Search query depends on query language.", |
| 57 | "schema": { |
| 58 | "type": "string" |
| 59 | } |
| 60 | }, |
| 61 | { |
| 62 | "name": "ql", |
| 63 | "in": "query", |
| 64 | "required": true, |
| 65 | "description": "Query language", |
| 66 | "schema": { |
| 67 | "type": "string", |
| 68 | "enum": [ |
| 69 | "poliqarp", |
| 70 | "cosmas2", |
| 71 | "annis", |
| 72 | "cql", |
| 73 | "fcsql" |
| 74 | ] |
| 75 | } |
| 76 | }, |
| 77 | { |
| 78 | "name": "v", |
| 79 | "in": "query", |
| 80 | "required": false, |
| 81 | "description": "CQL version number, not applicable for other query language.", |
| 82 | "schema": { |
| 83 | "type": "string", |
| 84 | "enum": [ |
| 85 | "1.1", |
| 86 | "1.2" |
| 87 | ] |
| 88 | } |
| 89 | }, |
| 90 | { |
| 91 | "name": "cq", |
| 92 | "in": "query", |
| 93 | "required": false, |
| 94 | "description": "Define a virtual corpus (collection of texts) in which the search should be done. If not specified, search will be done over all corpora.", |
| 95 | "schema": { |
| 96 | "type": "string" |
| 97 | }, |
| 98 | "examples": { |
| 99 | "creationDate": { |
| 100 | "summary": "Search in all documents with textClass wissenschaft or politik", |
| 101 | "value": "textClass=wissenschaft | textClass=politik" |
| 102 | }, |
| 103 | "corpusSigle": { |
| 104 | "summary": "Search in all documents with corpusSigle GOE and created since 1820", |
| 105 | "value": "corpusSigle=GOE & creationDate since 1820" |
| 106 | } |
| 107 | } |
| 108 | }, |
| 109 | { |
| 110 | "name": "context", |
| 111 | "in": "query", |
| 112 | "required": false, |
| 113 | "description": "Determine the size of the result context. The default context shows 6 tokens before and after a match.", |
| 114 | "schema": { |
| 115 | "type": "string", |
| 116 | "default": "6-token,6-token" |
| 117 | }, |
| 118 | "examples": { |
| 119 | "sentence": { |
| 120 | "summary": "Show sentence where a match occurs.", |
| 121 | "value": "sentence" |
| 122 | }, |
| 123 | "paragraph": { |
| 124 | "summary": "Show paragraph where a match occurs.", |
| 125 | "value": "paragraph" |
| 126 | }, |
| 127 | "token": { |
| 128 | "summary": "Set the number of tokens before and after a match.", |
| 129 | "value": "3-token,3-token" |
| 130 | }, |
| 131 | "char": { |
| 132 | "summary": "Set the number of characters before and after a match.", |
| 133 | "value": "10-chars,10-chars" |
| 134 | } |
| 135 | } |
| 136 | }, |
| 137 | { |
| 138 | "name": "fields", |
| 139 | "in": "query", |
| 140 | "required": false, |
| 141 | "description": "Determine which metadata fields should be shown in the results. Multiple fields are separated by comma.", |
| 142 | "schema": { |
| 143 | "type": "string" |
| 144 | }, |
| 145 | "examples": { |
| 146 | "single": { |
| 147 | "summary": "show a single field", |
| 148 | "value": "title" |
| 149 | }, |
| 150 | "multiple": { |
| 151 | "summary": "show multiple fields", |
| 152 | "value": "title, author, textClass, pubDate" |
| 153 | } |
| 154 | } |
| 155 | }, |
| 156 | { |
| 157 | "name": "engine", |
| 158 | "in": "query", |
| 159 | "required": false, |
| 160 | "description": "Determine which search engine should be used. Network is currently not available.", |
| 161 | "schema": { |
| 162 | "type": "string", |
| 163 | "enum": [ |
| 164 | "lucene", |
| 165 | "network" |
| 166 | ], |
| 167 | "default": "lucene" |
| 168 | } |
| 169 | }, |
| 170 | { |
| 171 | "name": "count", |
| 172 | "in": "query", |
| 173 | "required": false, |
| 174 | "description": "Determine the number of results per page.", |
| 175 | "schema": { |
| 176 | "type": "integer", |
| 177 | "default": 25 |
| 178 | } |
| 179 | }, |
| 180 | { |
| 181 | "name": "page", |
| 182 | "in": "query", |
| 183 | "required": false, |
| 184 | "description": "Determine the start page parameter for paging. If page and offset are both set, offset will be used.", |
| 185 | "schema": { |
| 186 | "type": "integer", |
| 187 | "default": 1 |
| 188 | } |
| 189 | }, |
| 190 | { |
| 191 | "name": "offset", |
| 192 | "in": "query", |
| 193 | "required": false, |
| 194 | "description": "Determine the start index parameter for paging. If page and offset are both set, offset will be used.", |
| 195 | "schema": { |
| 196 | "type": "integer", |
| 197 | "default": 0 |
| 198 | } |
| 199 | }, |
| 200 | { |
| 201 | "name": "cutoff", |
| 202 | "in": "query", |
| 203 | "required": false, |
| 204 | "description": "Determine if the search results should be limited to one page.", |
| 205 | "schema": { |
| 206 | "type": "boolean", |
| 207 | "default": false |
| 208 | } |
| 209 | }, |
| 210 | { |
| 211 | "name": "access-rewrite-disabled", |
| 212 | "in": "query", |
| 213 | "required": false, |
| 214 | "description": "Determine if access rewrite should be disabled. If set true, searching within copyrighted data for unauthenticated users is allowed, but only the public metadata of the results (without text snippets) are included in the response.", |
| 215 | "schema": { |
| 216 | "type": "boolean", |
| 217 | "default": false |
| 218 | } |
| 219 | }, |
| 220 | { |
| 221 | "name": "show-tokens", |
| 222 | "in": "query", |
| 223 | "required": false, |
| 224 | "description": "Determine if the match snippets should be shown as tokens in the results.", |
| 225 | "schema": { |
| 226 | "type": "boolean", |
| 227 | "default": false |
| 228 | } |
| 229 | }, |
| 230 | { |
| 231 | "name": "show-snippet", |
| 232 | "in": "query", |
| 233 | "required": false, |
| 234 | "description": "Determine if the match snippets should be shown.", |
| 235 | "schema": { |
| 236 | "type": "boolean", |
| 237 | "default": true |
| 238 | } |
| 239 | } |
| 240 | ], |
| 241 | "responses": { |
| 242 | "200": { |
| 243 | "description": "Successful operation" |
| 244 | }, |
| 245 | "400": { |
| 246 | "description": "Bad query parameter" |
| 247 | }, |
| 248 | "401": { |
| 249 | "description": "Invalid authorization" |
| 250 | } |
| 251 | } |
| 252 | } |
| 253 | }, |
| 254 | "/corpus/{corpus_id}/{doc_id}/{text_id}/{match_id}": { |
| 255 | "get": { |
| 256 | "tags": [ |
| 257 | "matchInfo" |
| 258 | ], |
| 259 | "summary": "Retrieve match information", |
| 260 | "description": "Returns annotations of a specific match", |
| 261 | "operationId": "matchInfo", |
| 262 | "parameters": [ |
| 263 | { |
| 264 | "name": "corpus_id", |
| 265 | "in": "path", |
| 266 | "description": "The corpus id of a match", |
| 267 | "required": true, |
| 268 | "schema": { |
| 269 | "type": "string" |
| 270 | } |
| 271 | }, |
| 272 | { |
| 273 | "name": "doc_id", |
| 274 | "in": "path", |
| 275 | "description": "The document id of a match", |
| 276 | "required": true, |
| 277 | "schema": { |
| 278 | "type": "string" |
| 279 | } |
| 280 | }, |
| 281 | { |
| 282 | "name": "text_id", |
| 283 | "in": "path", |
| 284 | "description": "The text id of a match", |
| 285 | "required": true, |
| 286 | "schema": { |
| 287 | "type": "string" |
| 288 | } |
| 289 | }, |
| 290 | { |
| 291 | "name": "match_id", |
| 292 | "in": "path", |
| 293 | "description": "The match id", |
| 294 | "required": true, |
| 295 | "schema": { |
| 296 | "type": "string" |
| 297 | } |
| 298 | }, |
| 299 | { |
| 300 | "name": "foundry", |
| 301 | "in": "query", |
| 302 | "required": false, |
| 303 | "description": "Retrieve annotations with all or specific foundries only. Without specifying this parameter, no foundry will be retrieved.", |
| 304 | "schema": { |
| 305 | "type": "string" |
| 306 | }, |
| 307 | "examples": { |
| 308 | "all foundries": { |
| 309 | "summary": "Retrieve annotations all foundries", |
| 310 | "value": "foundry=*" |
| 311 | }, |
| 312 | "single foundry": { |
| 313 | "summary": "Retrieve annotations with tt foundry only", |
| 314 | "value": "foundry=tt" |
| 315 | }, |
| 316 | "multiple foundry": { |
| 317 | "summary": "Retrieve annotations with corenlp or tt foundries only", |
| 318 | "value": "foundry=corenlp&foundry=tt" |
| 319 | } |
| 320 | } |
| 321 | }, |
| 322 | { |
| 323 | "name": "layer", |
| 324 | "in": "query", |
| 325 | "required": false, |
| 326 | "description": "Retrieve annotations with specific layers only", |
| 327 | "schema": { |
| 328 | "type": "string" |
| 329 | }, |
| 330 | "examples": { |
| 331 | "single foundry": { |
| 332 | "summary": "Retrieve annotations with part of speech layer only", |
| 333 | "value": "layer=p" |
| 334 | }, |
| 335 | "multiple foundry": { |
| 336 | "summary": "Retrieve annotations with part of speech and lemma layers only", |
| 337 | "value": "layer=p&foundry=l" |
| 338 | } |
| 339 | } |
| 340 | }, |
| 341 | { |
| 342 | "name": "span", |
| 343 | "in": "query", |
| 344 | "required": false, |
| 345 | "description": "Determine if spans should be retrieve.", |
| 346 | "schema": { |
| 347 | "type": "boolean", |
| 348 | "default": false |
| 349 | } |
| 350 | } |
| 351 | ], |
| 352 | "responses": { |
| 353 | "200": { |
| 354 | "description": "successful operation" |
| 355 | } |
| 356 | }, |
| 357 | "security": [ |
| 358 | { |
| 359 | "main_instance_authentication": [ |
| 360 | "match_info" |
| 361 | ] |
| 362 | }, |
| 363 | { |
| 364 | "test_instance_authentication": [ |
| 365 | "match_info" |
| 366 | ] |
| 367 | } |
| 368 | ] |
| 369 | } |
| 370 | }, |
| 371 | "/corpus/{corpus_id}/{doc_id}/{text_id}/": { |
| 372 | "get": { |
| 373 | "tags": [ |
| 374 | "metadata" |
| 375 | ], |
| 376 | "summary": "Retrieve metadata of a text", |
| 377 | "description": "Retrieve metadata of a text identified by a text sigle consisting of corpus_id, doc_id, and text_id.", |
| 378 | "operationId": "metadata", |
| 379 | "parameters": [ |
| 380 | { |
| 381 | "name": "corpus_id", |
| 382 | "in": "path", |
| 383 | "description": "The corpus id of a match", |
| 384 | "required": true, |
| 385 | "schema": { |
| 386 | "type": "string" |
| 387 | } |
| 388 | }, |
| 389 | { |
| 390 | "name": "doc_id", |
| 391 | "in": "path", |
| 392 | "description": "The document id of a match", |
| 393 | "required": true, |
| 394 | "schema": { |
| 395 | "type": "string" |
| 396 | } |
| 397 | }, |
| 398 | { |
| 399 | "name": "text_id", |
| 400 | "in": "path", |
| 401 | "description": "The text id of a match", |
| 402 | "required": true, |
| 403 | "schema": { |
| 404 | "type": "string" |
| 405 | } |
| 406 | }, |
| 407 | { |
| 408 | "name": "fields", |
| 409 | "in": "query", |
| 410 | "required": false, |
| 411 | "description": "Retrieve only speficied metadata fields of the text. By default, all metadata fields are retrieved.", |
| 412 | "schema": { |
| 413 | "type": "string" |
| 414 | }, |
| 415 | "examples": { |
| 416 | "single foundry": { |
| 417 | "summary": "Retrieve only the author of the text", |
| 418 | "value": "fields=author" |
| 419 | }, |
| 420 | "multiple foundry": { |
| 421 | "summary": "Retrieve the author, the textTypeArt and the title of the text", |
| 422 | "value": "fields=author,textTypeArt,title" |
| 423 | } |
| 424 | } |
| 425 | } |
| 426 | ], |
| 427 | "responses": { |
| 428 | "200": { |
| 429 | "description": "successful operation" |
| 430 | } |
| 431 | } |
| 432 | } |
| 433 | } |
| 434 | }, |
| 435 | "components": { |
| 436 | "securitySchemes": { |
| 437 | "main_instance_authentication": { |
| 438 | "type": "oauth2", |
| 439 | "flows": { |
| 440 | "authorizationCode": { |
| 441 | "authorizationUrl": "https://korap.ids-mannheim.de/settings/oauth/authorize", |
| 442 | "tokenUrl": "https://korap.ids-mannheim.de/api/v1.0/oauth2/token", |
| 443 | "scopes": { |
| 444 | "search": "search query", |
| 445 | "match_info": "retrieve match annotations" |
| 446 | } |
| 447 | } |
| 448 | } |
| 449 | }, |
| 450 | "test_instance_authentication": { |
| 451 | "type": "oauth2", |
| 452 | "flows": { |
| 453 | "authorizationCode": { |
| 454 | "authorizationUrl": "https://korap.ids-mannheim.de/instance/test/settings/oauth/authorize", |
| 455 | "tokenUrl": "https://korap.ids-mannheim.de/instance/test/api/v1.0/oauth2/token", |
| 456 | "scopes": { |
| 457 | "search": "search query", |
| 458 | "match_info": "retrieve match annotations" |
| 459 | } |
| 460 | } |
| 461 | } |
| 462 | } |
| 463 | } |
| 464 | } |
| 465 | } |