Test examples are simple document management systems that can be built into your application for testing. Do NOT use these integration examples on your own server without proper code modifications! In case you enabled any of the test examples, disable it before going for production.
These examples show the way to integrate ONLYOFFICE Docs into your own website or application using one of the programming languages. The package contains examples written in .Net (C# MVC), .Net (C#), Java, Node.js, PHP and Ruby.
You should change http://documentserver
to your server address in these files:
web/documentserver-example/csharp-mvc/web.appsettings.config
web/documentserver-example/csharp/settings.config
web/documentserver-example/java/src/main/resources/settings.properties
web/documentserver-example/java-spring/src/main/resources/application.properties
web/documentserver-example/nodejs/config/default.json
web/documentserver-example/php/config.json
web/documentserver-example/python/config.py
web/documentserver-example/ruby/config/application.rb
More information on how to use these examples can be found here: http://api.onlyoffice.com/editors/demopreview
The methods described below are available for all of the test examples.
/upload
Summary | Upload file to test example via request |
URL | /upload |
Method | POST |
Request Headers |
Content-Type: multipart/form-data |
Request Body |
uploadedFile=@<filepath> filepath - file for uploadingMultipart body with the file binary contents |
Response | Code: 200 OK Content on success: { "filename": <filename>} Content on error: { "error": "Uploaded file not found" } Or { "error": "File size is incorrect" } |
Sample | curl -X POST -F uploadedFile=@filename.docx http://localhost/upload |
/file
Summary | Delete one file or all files |
URL | /file |
Method | DELETE |
URL Params | Optional:filename=[string] - file for deleting. WARNING! Without this parameter, all files will be deleted |
Response | Code: 200 OK Success: { "success": true } |
Sample | Delete one file:curl -X DELETE http://localhost/file?filename=filename.docx Delete all files: curl -X DELETE http://localhost/file |
/files
Summary | Get information about all files |
URL | /files |
Method | GET |
Response | Code: 200 OK Success: [{ "version": <file_version>, "id": <file_id>, "contentLength": <file_size_in_kilobytes>, "pureContentLength": <file_size_in_bytes>, "title": <file_name>, "updated": <last_change_date>}, ..., {...}] |
Sample | curl -X GET http://localhost/files/ |
/files/file/{fileId}
Summary | Get information about a file by file id |
URL | /files/file/{fileId} |
Method | GET |
Response | Code: 200 OK Content on success: [{ "version": <file_version>, "id": <file_id>, "contentLength": <file_size_in_kilobytes>, "pureContentLength": <file_size_in_bytes>, "title": <file_name>, "updated": <last_change_date>}] Content on error: "File not found" |
Sample | curl -X GET http://localhost/files/{fileId} |
Please keep in mind the following security aspects when you are using test examples:
Official website: https://www.onlyoffice.com
Code repository: https://github.com/ONLYOFFICE/document-server-integration
ONLYOFFICE for developers: https://www.onlyoffice.com/developer-edition.aspx
If you have any problems with or questions about ONLYOFFICE Document Server, please visit our official forum to find answers to your questions: forum.onlyoffice.com or you can ask and answer ONLYOFFICE development questions on Stack Overflow.
document-server-integration is released under the Apache-2.0 License. See the LICENSE file for more information.