Wiki source code of REST API

Last modified by Eleni Cojocariu on 2026/07/13 14:38

Show last authors
1 The REST API provides a convenient way to manage both collections and documents inside collections from external tools. This can be used in other applications to add, update and delete content that is indexed in the LLM application whenever content is added, changed or deleted the application.
2
3 == Collections Resource ==
4
5 GET /wikis/{wikiName}/aiLLM/collections
6
7 Returns a list of all collection IDs that the current user can access as an array of strings.
8
9 == Collection Resource ==
10
11 A collection object has the following properties:
12
13 |=Name |=Type |=Description
14 |id |String| id of the collection
15 |title |String|pretty name of the collection
16 |embedding_model|String|the embedding model as reference of the page that defines the model
17 |chunking_method|String|the chunking method, should be maxChars
18 |chunking_max_size|int| the maximum size of a chunk
19 |chunking_overlap_offset|int|the overlap of chunks
20 |document_spaces|List of strings|the list of XWiki spaces indexed by this collection, currently not used
21 |allow_guests|boolean|if guests can query this collection (as part of a chat completion)
22 |query_groups|List of strings|the list of groups that are allowed to query this collection (as part of a chat completion). This is only used when guests aren't allowed to query the collection.
23 |rights_check_method|String|the method used for checking access rights of individual documents during queries. Supported values: public, external. See also [[the Authorization section of the Index for the LLM Application>>||anchor="HAuthorization"]].
24 |rights_check_method_configuration|Object|options of the rights check method, values depend on the selected rights check method. The "external" rights check method supports the url parameter which is the URL that is used to check rights for all found documents.
25
26 === GET /wikis/{wikiName}/aiLLM/collections/{collectionName} ===
27
28 Returns the collection of the given name.
29
30 === PUT /wikis/{wikiName}/aiLLM/collections/{collectionName} ===
31
32 Creates or updates the collection of the given name. The body of the request is a collection, if not all properties are specified, only the specified properties are updated.
33
34 === DELETE /wikis/{wikiName}/aiLLM/collections/{collectionName} ===
35
36 Deletes the collection of the given name
37
38 === GET /wikis/{wikiName}/aiLLM/collections/{collectionName}/documents ===
39
40 Returns a list of document IDs that are contained in the collection of the given name. This resource supports the following query parameters:
41
42 |=Name|=Description
43 |start|the index of the first document to retrieve (default: 0)
44 |number|the number of documents to retrieve (default: -1)
45
46 == Document Resource ==
47
48 A document object has the following properties, all properties are strings:
49
50 |=Name|=Description
51 |id|id of the document
52 |title|pretty name of the document
53 |language|the language of the document (currently not used)
54 |url|the URL of the document, used to display a link to the original resource when the document is used as context in a chat
55 |collection|the name of the collection the document is part of
56 |mimetype|the mime type of the document, currently not used, could be used in the future to use a chunking method that is specific to the mime type
57 |content|the content of the document that is indexed
58
59 === GET /wikis/{wikiName}/aiLLM/collections/{collectionName}/documents/{documentID} ===
60
61 Returns the document of the given name in the collection of the given name.
62
63 === PUT /wikis/{wikiName}/aiLLM/collections/{collectionName}/documents/{documentID} ===
64
65 Creates or updates the document of the given name in the collection of the given name. The body of the request is a document, if not all properties are specified, only the specified properties are updated.
66
67 === DELETE /wikis/{wikiName}/aiLLM/collections/{collectionName}/documents/{documentID} ===
68
69 Deletes the document of the given name in the collection of the given name.
70
71 {{version since="0.8" product="LLM"}}
72 == Search Resource ==
73
74 The search resource allows searching in indexed content. In contrast to the previous APIs, rights aren't checked based on standard XWiki rights but based on the ##allow_guests## flag and the query groups. This API is basically the same as the ##search_wiki## tool in the [[MCP Server>>documentation.extensions.user.llm.mcp-server.WebHome]].
75
76 ##POST /wikis/{wikiName}/aiLLM/search##
77
78 Supported parameters:
79
80 |=Name|=Type|=Description
81 |query|String|The query to search for
82 |collection|String (can be specified several times)|The IDs of the collections to search in, when omitted, all accessible collections are searched
83 |limitKeywordResults|int|The maximum number of results to return based on keyword search (default: 10)
84 |limitSemanticResults|int|The maximum number of results to return based on semantic search (default: 10)
85
86 == Search Collections Resource ==
87
88 The search collections resource returns all collections that the current user can access for search. This allows presenting users a list of collections they can select for search.
89
90 ##GET /wikis/{wikiName}/aiLLM/search/collections##
91
92 Supported parameters: none.
93
94 Result: A list of [[collection resources>>||anchor="HCollectionResource"]] with only ##id## and ##title## properties.
95 {{/version}}

Get Connected