Skip to main content

Docs API integration samples

The integration examples are small web applications that list files, open them in ONLYOFFICE Docs, and save them back through the callback handler. Each one does the same job in a different language or framework. Run the one closest to your stack to see a complete integration working before you write your own. The source code of all examples is in the document-server-integration repository.

ONLYOFFICE Docs also includes the Node.js example. It is disabled by default. To enable it, follow the instructions on the ONLYOFFICE Docs start page.

warning

The examples are for testing only. They have no authentication, do not validate link parameters or save requests, and accept requests from any site, so anyone who can reach them can read and change their files. Do not run them on a public server, and disable them before going to production.

Examples​

ExampleBuilt withSettingsRuns with
.NET (C#)ASP.NET Web Forms and ASP.NET MVCsettings.config, web.appsettings.configVisual Studio and IIS, Windows only
Gogorilla/muxconfig/configuration.jsongo run
JavaServlets and JSPsrc/main/resources/settings.propertiesDocker Compose
Java SpringSpring Bootsrc/main/resources/application.propertiesMaven
Node.jsExpressconfig/default.jsonnpm
PHPNo frameworkEnvironment variablesPHP built-in server or Docker Compose
PHP LaravelLaravel.envDocker Compose
PythonDjangoEnvironment variablesDjango server or Docker Compose
RubyRuby on RailsEnvironment variablesMake

To build a Java integration on a library instead of starting from an example, see the Java SDK.

What every example needs​

Whichever example you choose, you set the same three things:

  • The address of ONLYOFFICE Docs, from which the browser loads the editors and to which the example sends its requests.
  • The JWT secret, which must match the secret key of ONLYOFFICE Docs.
  • The address of the example, at which ONLYOFFICE Docs downloads files and sends the callback. Set it when ONLYOFFICE Docs runs on another computer or in Docker, where localhost points somewhere else.

Each example page shows where these settings are and what they are called.