ONLYOFFICE Docs 8.2 for developers: API updates
Along with the release of the new features in version 8.2, we updated API for the editors, Office API, and plugins, added Java Framework for Document Builder as well as PHP integration SDK. Check all the details below.
Zero-downtime deployment
Zero-downtime deployment is a great way to update an application without requiring any pauses. So, it’s possible to upgrade the editors without having to take them offline.
How it works? The ONLYOFFICE Docs (Document Server, DS) instance with the new version is launched in parallel to the currently running Document Server. New editing sessions are opened in the new DS. The previous DS version is functioning until the users finish their editing sessions themselves. Only after that the previous DS stops.
If speaking about ONLYOFFICE Docs Shards, here we are able to direct an editing session to the specific DS in the cluster. Therefore, it is possible to have Document Servers of different versions work in parallel. Don’t forget to take into consideration that duplicating resources and the updating process itself may take some time.
Please note: Zero-downtime deployment is available for ONLYOFFICE Docs delivered as Kubernetes Shards. Interested to learn more? Just reach out to us via sales@onlyoffice.com.
PHP integration SDK
Easily integrate ONLYOFFICE Docs into your application written on PHP. The SDK includes the general code for PHP integrations, creating initialization configuration and handling common methods on the backend. Check it out
The PHP SDK is now implemented, for example, in the ONLYOFFICE and Chamilo integration.
New interface styles
The editorConfig.customization.features parameter brings two further fields – tabStyle and tabBackground. This way, you can adjust the editor appearance to your liking.
The former allows setting the Fill (top toolbar tabs are distinctly displayed) or Line style (top toolbar tabs are highlighted by underlining).
The latter defines if the background of the top toolbar tabs matches the header background or the toolbar background.
Besides, we added the imageLight field to the editorConfig.customization.logo parameter. It defines the path to the image file used for the light header, for example, in the newly added Gray theme.
const logo = {
image: "https://example.com/logo.png",
imageDark: "https://example.com/dark-logo.png",
imageLight: "https://example.com/light-logo.png",
url: "https://example.com",
visible: true,
}
Text insertion from third-party sources
The insert-text type of document selection is added to the c parameter of the setRequestedDocument method. This way, users can select a document from the local/URL/storage file to insert its contents into the current doc.
docEditor.setRequestedDocument({
c: "insert-text",
fileType: "docx",
url: "https://example.com/url-to-example-document.docx",
...
Document status check
The users parameter is now added to the response of the info command. This parameter defines the list of the identifiers of the users who opened the document for editing. When the document has been changed, the users will return the identifier of the user who was the last to edit the document.
{
"error": 0,
"key": "Khirz6zTPdfd7",
"users": ["6d5a81d0", "78e1e841"]
}
What else is changed for the Docs API
- New request parameters for the WOPI conversion API to work with protected documents: Password and PasswordToOpen.
- The https://documentserver/coauthoring/CommandService.ashx address of the command service is replaced with https://documentserver/command.
- For the conversion service, please use the https://documentserver/converter address.
- The editorConfig.location field is deprecated. Please use the editorConfig.region field instead to define the default measurement units in all editor types.
- The editorConfig.customization.toolbarNoTabs field is deprecated, please use the editorConfig.customization.features.tabStyle and editorConfig.customization.features.tabBackground fields instead.
Get the latest version of ONLYOFFICE Docs Developer:
Email notifications: license and quota limit warnings
It’s now possible to send out email notifications, for example, that the license is about to expire or connection limit is about to be reached.
How it works? We added the ability to set mail server settings to the server config. An external mail server is used to send notifications, the connection to which is carried out through the Nodemailer library. Many settings from the server config are transferred directly to this library.
API enhancements for plugins
The plugin API also brings useful enhancements, namely methods for performing Undo and Redo actions.
api.prototype.Undo = function()
api.prototype.Redo = function()
api.prototype.CanUndo = function()
api.prototype.CanRedo = function()
Check the full list of the plugin API updates.
Java Framework for Document Builder
For ONLYOFFICE Document Builder, there is now a Java Builder Framework available. It contains a collection of libraries, classes, and functions that make it much easier to quickly develop applications in Java that feature document creation abilities.
Office API
For the Office JavaScript API, we added lots of new methods for the version 8.2, including those for:
- ranges;
- Pivot tables;
- placeholders;
- getting and replacing words/sentences;
- updating all fields;
- outlines;
- and others.
Check the full list of new methods.
Create your free ONLYOFFICE account
View, edit and collaborate on docs, sheets, slides, forms, and PDF files online.