Server-side Editor API
The Server-side Editor API enables deep and complex integration of your application with all document data, enabling you to manipulate content and manage collaborative data such as suggestions, comments, and revision history, and much more, directly from your server-side code.
The remote script REST API endpoint allows you to execute any JavaScript code that uses the CKEditor 5 API, that could be executed by a browser, but without the need to open the editor by a human user. Instead, the script is executed on the Cloud Services server allowing for updating and interacting with active collaboration sessions remotely.
# Why use server-side editor API?
There are many scenarios where server-side content processing is essential:
- Automation: Run content processing tasks as part of your backend workflows.
- Scalability: Process multiple documents simultaneously without client-side limitations.
- Security: Process sensitive content in a controlled environment without exposing it to client-side manipulation.
- Performance: Handle large-scale content operations without impacting the user’s browser.
- Consistency: Ensure uniform content changes across multiple documents.
- Integration: Connect with other server-side systems and databases directly.
# Common use cases
- Deep integration: Build custom features that can manage document content and related document data straight from your application UI, without a need to open the editor.
- Content migration: Restructure and update references across multiple documents, perfect for website redesigns or content reorganization.
- Shared content blocks: Automatically update reusable content (like headers, footers, or common sections) across all documents that use it.
- Automated review systems: Build systems that automatically review and suggest content changes, like grammar checks or style improvements.
- AI-powered editing: Make automated suggestions while users are actively editing, helping improve content quality.
- Automated publishing: Prepare and process content for publication, including formatting, metadata updates, and resolving comments.
# Quick example
Here’s a basic example of how to use the Server-side Editor API:
Endpoint:
POST /collaborations/{document_id}/evaluate-script
Request body:
{
"script": "const content = editor.getData(); return { content: content, wordCount: content.split(' ').length };",
}
Response:
{
"data": {
"content": "<p>Document content here...</p>",
"wordCount": 15
}
}