REST
KM REST Connector: Integration Guide
Welcome to the Leena AI KM REST Connector documentation. This connector allows you to push knowledge base articles and attachments directly into the Leena Knowledge Base from your own source systems.
By using the REST API, you gain granular control over content selection, update frequency, and user-level permissions.
Integration Architecture
The integration follows a sequential flow: authenticating your session, staging any necessary assets (attachments), and finally syncing the article data into our system.
1. Authentication (OAuth 2.0)
Before interacting with any data endpoints, you must obtain a temporary Bearer Token.
- Credentials: Your Leena AI representative will provide your
clientId,clientSecret,username, andpassword. - Method:
POST - Endpoint:
/api/v1.0/oauth/token - Token Validity: 30 minutes (default). We recommend implementing a token refresh logic within your middleware.
2. Uploading Attachments
If your articles include supplementary files (PDFs, Images, etc.), they must be staged in the Leena environment before the article is created.
- Method:
POST - Endpoint:
/api/integration/articles/upload/ - Input: File (Multipart/form-data) and Metadata (Mime Type).
- Output: An
attachment_id.
Note: Save this ID; you will need to reference it in the final sync step to link the file to the article.
Supported File Types:
| Category | Formats |
|---|---|
| Documents | PDF, DOC, DOCX, TXT, HTML |
| Data/Slides | XLS, XLSX, PPT, PPTX |
| Images | PNG, JPEG |
3. Pushing Knowledge Articles
This is the core synchronization API. It maps your source content to the Leena Knowledge Base.
- Method:
POST - Endpoint:
/api/integration/articles/sync/
Key Schema Fields:
reference_id: Your unique source system ID (used for future updates).html_content: The main body of the article (must be valid HTML).attachments: An array ofattachment_ids generated in Step 2.permissions: Defines visibility logic (e.g., department, location, or user groups).
4. Lifecycle Management
Initial Migration (Bulk Load)
Once you have pushed your entire library of existing articles, you must trigger the final processing engine.
- Endpoint:
/sync/complete/ - Action: Call this API once the initial load is finished to index the content for search.
Delta Updates
For ongoing maintenance, simply call the Push Knowledge Article API (Step 3) whenever an article is created or modified in your system. Use the same reference_id to overwrite the existing record.
5. Locate within Knowledge Management
The feature can be found within Settings--->Integrations---->Rest API---> Add connector.
Updated about 10 hours ago
