mirror of
https://github.com/ONLYOFFICE/document-server-integration.git
synced 2026-02-10 18:05:10 +08:00
docs: correct API methods are in each example's own readme
This commit is contained in:
50
Readme.md
50
Readme.md
@ -21,56 +21,6 @@ You should change `http://documentserver` to your server address in these files:
|
||||
|
||||
More information on how to use these examples can be found here: [https://api.onlyoffice.com/docs/docs-api/samples/language-specific-examples/](https://api.onlyoffice.com/docs/docs-api/samples/language-specific-examples/)
|
||||
|
||||
## API methods for test examples
|
||||
|
||||
The methods described below are available for all of the test examples.
|
||||
|
||||
### POST `/upload`
|
||||
|
||||
| | |
|
||||
| ---------------------- | ------------------------------------------------------------ |
|
||||
| **Summary** | Upload file to test example via request |
|
||||
| **URL** | /upload |
|
||||
| **Method** | POST |
|
||||
| **Request<br>Headers** | `Content-Type: multipart/form-data` |
|
||||
| **Request<br>Body** | `uploadedFile=@<filepath>`<br> `filepath` - file for uploading<br />Multipart body with the file binary contents |
|
||||
| **Response** | **Code:** 200 OK <br />**Content on success:**<br /> `{ "filename": <filename>}`<br />**Content on error:**<br /> `{ "error": "Uploaded file not found" }` <br /> Or <br /> `{ "error": "File size is incorrect" }` |
|
||||
| **Sample** | `curl -X POST -F uploadedFile=@filename.docx http://localhost/upload` |
|
||||
|
||||
|
||||
### DELETE `/file`
|
||||
|
||||
| | |
|
||||
| ------------------ | ------------------------------------------------------------ |
|
||||
| **Summary** | Delete one file or all files |
|
||||
| **URL** | /file |
|
||||
| **Method** | DELETE |
|
||||
| ****URL Params**** | **Optional:**<br /> `filename=[string]` - file for deleting. <br /> *WARNING! Without this parameter, all files will be deleted* |
|
||||
| **Response** | **Code:** 200 OK <br /> **Success:**<br /> `{ "success": true }` |
|
||||
| **Sample** | **Delete one file:**<br />`curl -X DELETE http://localhost/file?filename=filename.docx`<br />**Delete all files:**<br />`curl -X DELETE http://localhost/file`<br /> |
|
||||
|
||||
|
||||
### GET `/files`
|
||||
|
||||
| | |
|
||||
| ------------------ | ------------------------------------------------------------ |
|
||||
| **Summary** | Get information about all files |
|
||||
| **URL** | /files |
|
||||
| **Method** | GET |
|
||||
| **Response** | **Code:** 200 OK <br /> **Success:**<br /> `[{ "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/` |
|
||||
|
||||
|
||||
### GET `/files/file/{fileId}`
|
||||
|
||||
| | |
|
||||
| ------------------ | ------------------------------------------------------------ |
|
||||
| **Summary** | Get information about a file by file id |
|
||||
| **URL** | /files/file/{fileId} |
|
||||
| **Method** | GET |
|
||||
| **Response** | **Code:** 200 OK <br />**Content on success:**<br /> `[{ "version": <file_version>, "id": <file_id>, "contentLength": <file_size_in_kilobytes>, "pureContentLength": <file_size_in_bytes>, "title": <file_name>, "updated": <last_change_date>}]`<br />**Content on error:**<br /> `"File not found"` |
|
||||
| **Sample** | `curl -X GET http://localhost/files/{fileId}` |
|
||||
|
||||
## Important security info
|
||||
|
||||
Please keep in mind the following security aspects when you are using test examples:
|
||||
|
||||
@ -79,6 +79,45 @@ In case the example and Document Server are installed on different computers, ma
|
||||
|
||||
Make sure that the Document Server has access to the server with the example installed with the address which you specify instead of **example.com** in the configuration files.
|
||||
|
||||
## File API methods used in this example
|
||||
|
||||
The methods described below are available for .Net (C# MVC) test example.
|
||||
|
||||
### POST `/webeditor.ashx?type=upload`
|
||||
|
||||
| | |
|
||||
| ---------------------- | ------------------------------------------------------------ |
|
||||
| **Summary** | Upload file to test example via request |
|
||||
| **URL** | /webeditor.ashx?type=upload |
|
||||
| **Method** | POST |
|
||||
| **Request<br>Headers** | `Content-Type: multipart/form-data` |
|
||||
| **Request<br>Body** | `uploadedFile=@<filepath>`<br> `filepath` - file for uploading<br />Multipart body with the file binary contents |
|
||||
| **Response** | **Code:** 200 OK <br />**Content on success:**<br /> `{ "filename": <filename>}`<br />**Content on error:**<br /> `{ "error": "File type is not supported" }` <br /> Or <br /> `{ "error": "File size is incorrect" }` |
|
||||
| **Sample** | `curl -X POST -F uploadedFile=@filename.docx http://localhost/webeditor.ashx?type=upload` |
|
||||
|
||||
|
||||
### GET `/webeditor.ashx?type=remove`
|
||||
|
||||
| | |
|
||||
| ------------------ | ------------------------------------------------------------ |
|
||||
| **Summary** | Delete one file or all files |
|
||||
| **URL** | /webeditor.ashx?type=remove |
|
||||
| **Method** | GET |
|
||||
| ****URL Params**** | **Optional:**<br /> `filename=[string]` - file for deleting. <br /> *WARNING! Without this parameter, all files will be deleted* |
|
||||
| **Response** | **Code:** 200 OK <br /> **Success:**<br /> `{ "success": true }` |
|
||||
| **Sample** | **Delete one file:**<br />`curl -X GET http://localhost/webeditor.ashx?type=remove&filename=filename.docx`<br />**Delete all files:**<br />`curl -X GET http://localhost/webeditor.ashx?type=remove`<br /> |
|
||||
|
||||
|
||||
### GET `/webeditor.ashx?type=files`
|
||||
|
||||
| | |
|
||||
| ------------------ | ------------------------------------------------------------ |
|
||||
| **Summary** | Get information about all files |
|
||||
| **URL** | /webeditor.ashx?type=files |
|
||||
| **Method** | GET |
|
||||
| **Response** | **Code:** 200 OK <br /> **Success:**<br /> `[{ "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/webeditor.ashx?type=files` |
|
||||
|
||||
## Important security info
|
||||
|
||||
Please keep in mind the following security aspects when you are using test examples:
|
||||
|
||||
@ -81,6 +81,45 @@ In case the example and Document Server are installed on different computers, ma
|
||||
|
||||
Make sure that the Document Server in its turn has access to the server with the example installed with the address which you specify instead of **example.com** in the configuration files.
|
||||
|
||||
## File API methods used in this example
|
||||
|
||||
The methods described below are available for .Net (C#) test example.
|
||||
|
||||
### POST `/webeditor.ashx?type=upload`
|
||||
|
||||
| | |
|
||||
| ---------------------- | ------------------------------------------------------------ |
|
||||
| **Summary** | Upload file to test example via request |
|
||||
| **URL** | /webeditor.ashx?type=upload |
|
||||
| **Method** | POST |
|
||||
| **Request<br>Headers** | `Content-Type: multipart/form-data` |
|
||||
| **Request<br>Body** | `uploadedFile=@<filepath>`<br> `filepath` - file for uploading<br />Multipart body with the file binary contents |
|
||||
| **Response** | **Code:** 200 OK <br />**Content on success:**<br /> `{ "filename": <filename>}`<br />**Content on error:**<br /> `{ "error": "File type is not supported" }` <br /> Or <br /> `{ "error": "File size is incorrect" }` |
|
||||
| **Sample** | `curl -X POST -F uploadedFile=@filename.docx http://localhost/webeditor.ashx?type=upload` |
|
||||
|
||||
|
||||
### GET `/webeditor.ashx?type=remove`
|
||||
|
||||
| | |
|
||||
| ------------------ | ------------------------------------------------------------ |
|
||||
| **Summary** | Delete one file or all files |
|
||||
| **URL** | /webeditor.ashx?type=remove |
|
||||
| **Method** | GET |
|
||||
| ****URL Params**** | **Optional:**<br /> `filename=[string]` - file for deleting. <br /> *WARNING! Without this parameter, all files will be deleted* |
|
||||
| **Response** | **Code:** 200 OK <br /> **Success:**<br /> `{ "success": true }` |
|
||||
| **Sample** | **Delete one file:**<br />`curl -X GET http://localhost/webeditor.ashx?type=remove&filename=filename.docx`<br />**Delete all files:**<br />`curl -X GET http://localhost/webeditor.ashx?type=remove`<br /> |
|
||||
|
||||
|
||||
### GET `/webeditor.ashx?type=files`
|
||||
|
||||
| | |
|
||||
| ------------------ | ------------------------------------------------------------ |
|
||||
| **Summary** | Get information about all files |
|
||||
| **URL** | /webeditor.ashx?type=files |
|
||||
| **Method** | GET |
|
||||
| **Response** | **Code:** 200 OK <br /> **Success:**<br /> `[{ "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/webeditor.ashx?type=files` |
|
||||
|
||||
## Important security info
|
||||
|
||||
Please keep in mind the following security aspects when you are using test examples:
|
||||
|
||||
@ -79,3 +79,51 @@ Also, [specify the same secret key](https://helpcenter.onlyoffice.com/installati
|
||||
### Step 7. Check accessibility
|
||||
|
||||
In case the example and Document Server are installed on different computers, make sure that your server with the example installed has access to the Document Server with the address which you specify instead of **documentserver** in the configuration files.
|
||||
|
||||
## File API methods used in this example
|
||||
|
||||
The methods described below are available for Go test example.
|
||||
|
||||
### POST `/upload`
|
||||
|
||||
| | |
|
||||
| ---------------------- | ------------------------------------------------------------ |
|
||||
| **Summary** | Upload file to test example via request |
|
||||
| **URL** | /upload |
|
||||
| **Method** | POST |
|
||||
| **Request<br>Headers** | `Content-Type: multipart/form-data` |
|
||||
| **Request<br>Body** | `uploadedFile=@<filepath>`<br> `filepath` - file for uploading<br />Multipart body with the file binary contents |
|
||||
| **Response** | **Code:** 200 OK <br />**Content on success:**<br /> `{ "filename": <filename>}`<br />**Content on error:**<br /> `{ "error": "File type is not supported" }` <br /> Or <br /> `{ "error": "File size is incorrect" }` |
|
||||
| **Sample** | `curl -X POST -F uploadedFile=@filename.docx http://localhost/upload` |
|
||||
|
||||
|
||||
### GET `/remove`
|
||||
|
||||
| | |
|
||||
| ------------------ | ------------------------------------------------------------ |
|
||||
| **Summary** | Delete one file |
|
||||
| **URL** | /remove |
|
||||
| **Method** | GET |
|
||||
| ****URL Params**** | `filename=[string]` - file for deleting. |
|
||||
| **Response** | **Code:** 200 OK <br /> **Success:**<br /> `{ "success": true }` |
|
||||
| **Sample** | `curl -X GET http://localhost/remove?filename=filename.docx` |
|
||||
|
||||
### DELETE `/remove`
|
||||
|
||||
| | |
|
||||
| ------------------ | ------------------------------------------------------------ |
|
||||
| **Summary** | Delete all files |
|
||||
| **URL** | /remove |
|
||||
| **Method** | DELETE |
|
||||
| **Response** | **Code:** 200 OK <br /> **Success:**<br /> `{ "success": true }` |
|
||||
| **Sample** |`curl -X DELETE http://localhost/remove` |
|
||||
|
||||
### GET `/files`
|
||||
|
||||
| | |
|
||||
| ------------------ | ------------------------------------------------------------ |
|
||||
| **Summary** | Get information about all files |
|
||||
| **URL** | /files |
|
||||
| **Method** | GET |
|
||||
| **Response** | **Code:** 200 OK <br /> **Success:**<br /> `[{ "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` |
|
||||
|
||||
@ -295,6 +295,45 @@ In case the example and Document Server are installed on different computers, ma
|
||||
|
||||
Make sure that the Document Server has access to the server with the example installed with the address which you specify instead of **example.com** in the configuration files.
|
||||
|
||||
## File API methods used in this example
|
||||
|
||||
The methods described below are available for Java (Spring) test example.
|
||||
|
||||
### POST `/upload`
|
||||
|
||||
| | |
|
||||
| ---------------------- | ------------------------------------------------------------ |
|
||||
| **Summary** | Upload file to test example via request |
|
||||
| **URL** | /upload |
|
||||
| **Method** | POST |
|
||||
| **Request<br>Headers** | `Content-Type: multipart/form-data` |
|
||||
| **Request<br>Body** | `uploadedFile=@<filepath>`<br> `filepath` - file for uploading<br />Multipart body with the file binary contents |
|
||||
| **Response** | **Code:** 200 OK <br />**Content on success:**<br /> `{ "filename": <filename>}`<br />**Content on error:**<br /> `{ "error": "File type is not supported" }` <br /> Or <br /> `{ "error": "File size is incorrect" }` |
|
||||
| **Sample** | `curl -X POST -F uploadedFile=@filename.docx http://localhost/upload` |
|
||||
|
||||
|
||||
### POST `/delete`
|
||||
|
||||
| | |
|
||||
| ------------------ | ------------------------------------------------------------ |
|
||||
| **Summary** | Delete one file or all files |
|
||||
| **URL** | /delete |
|
||||
| **Method** | POST |
|
||||
| ****Body Params**** | **Optional:**<br /> `filename: string` - file for deleting. <br /> *WARNING! Without this parameter, all files will be deleted* |
|
||||
| **Response** | **Code:** 200 OK <br /> **Success:**<br /> `{ "success": true }` |
|
||||
| **Sample** | **Delete one file:**<br />`curl -X POST http://localhost/delete -d '{"filename": "filename.docx"}'`<br />**Delete all files:**<br />`curl -X POST http://localhost/delete`<br /> |
|
||||
|
||||
|
||||
### GET `/files`
|
||||
|
||||
| | |
|
||||
| ------------------ | ------------------------------------------------------------ |
|
||||
| **Summary** | Get information about all files |
|
||||
| **URL** | /files |
|
||||
| **Method** | GET |
|
||||
| **Response** | **Code:** 200 OK <br /> **Success:**<br /> `[{ "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` |
|
||||
|
||||
## Important security info
|
||||
|
||||
Please keep in mind the following security aspects when you are using test examples:
|
||||
|
||||
@ -312,6 +312,45 @@ In case the example and Document Server are installed on different computers, ma
|
||||
|
||||
Make sure that the Document Server has access to the server with the example installed with the address which you specify instead of **example.com** in the configuration files.
|
||||
|
||||
## File API methods used in this example
|
||||
|
||||
The methods described below are available for Java test example.
|
||||
|
||||
### POST `/IndexServlet?type=upload`
|
||||
|
||||
| | |
|
||||
| ---------------------- | ------------------------------------------------------------ |
|
||||
| **Summary** | Upload file to test example via request |
|
||||
| **URL** | /IndexServlet?type=upload |
|
||||
| **Method** | POST |
|
||||
| **Request<br>Headers** | `Content-Type: multipart/form-data` |
|
||||
| **Request<br>Body** | `uploadedFile=@<filepath>`<br> `filepath` - file for uploading<br />Multipart body with the file binary contents |
|
||||
| **Response** | **Code:** 200 OK <br />**Content on success:**<br /> `{ "filename": <filename>}`<br />**Content on error:**<br /> `{ "error": "File type is not supported" }` <br /> Or <br /> `{ "error": "File size is incorrect" }` |
|
||||
| **Sample** | `curl -X POST -F uploadedFile=@filename.docx http://localhost/IndexServlet?type=upload` |
|
||||
|
||||
|
||||
### GET `/IndexServlet?type=remove`
|
||||
|
||||
| | |
|
||||
| ------------------ | ------------------------------------------------------------ |
|
||||
| **Summary** | Delete one file or all files |
|
||||
| **URL** | /IndexServlet?type=remove |
|
||||
| **Method** | GET |
|
||||
| ****URL Params**** | **Optional:**<br /> `filename=[string]` - file for deleting. <br /> *WARNING! Without this parameter, all files will be deleted* |
|
||||
| **Response** | **Code:** 200 OK <br /> **Success:**<br /> `{ "success": true }` |
|
||||
| **Sample** | **Delete one file:**<br />`curl -X GET http://localhost/IndexServlet?type=remove&filename=filename.docx`<br />**Delete all files:**<br />`curl -X GET http://localhost/IndexServlet?type=remove`<br /> |
|
||||
|
||||
|
||||
### GET `/IndexServlet?type=files`
|
||||
|
||||
| | |
|
||||
| ------------------ | ------------------------------------------------------------ |
|
||||
| **Summary** | Get information about all files |
|
||||
| **URL** | /IndexServlet?type=files |
|
||||
| **Method** | GET |
|
||||
| **Response** | **Code:** 200 OK <br /> **Success:**<br /> `[{ "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/IndexServlet?type=files` |
|
||||
|
||||
## Important security info
|
||||
|
||||
Please keep in mind the following security aspects when you are using test examples:
|
||||
|
||||
@ -197,6 +197,45 @@ In case the example and Document Server are installed on different computers, ma
|
||||
|
||||
Make sure that the Document Server has access to the server with the example installed with the address which you specify instead of **example.com** in the configuration files.
|
||||
|
||||
## File API methods used in this example
|
||||
|
||||
The methods described below are available for Node.js test example.
|
||||
|
||||
### POST `/upload`
|
||||
|
||||
| | |
|
||||
| ---------------------- | ------------------------------------------------------------ |
|
||||
| **Summary** | Upload file to test example via request |
|
||||
| **URL** | /upload |
|
||||
| **Method** | POST |
|
||||
| **Request<br>Headers** | `Content-Type: multipart/form-data` |
|
||||
| **Request<br>Body** | `uploadedFile=@<filepath>`<br> `filepath` - file for uploading<br />Multipart body with the file binary contents |
|
||||
| **Response** | **Code:** 200 OK <br />**Content on success:**<br /> `{ "filename": <filename>}`<br />**Content on error:**<br /> `{ "error": "File type is not supported" }` <br /> Or <br /> `{ "error": "File size is incorrect" }` |
|
||||
| **Sample** | `curl -X POST -F uploadedFile=@filename.docx http://localhost/upload` |
|
||||
|
||||
|
||||
### DELETE `/file`
|
||||
|
||||
| | |
|
||||
| ------------------ | ------------------------------------------------------------ |
|
||||
| **Summary** | Delete one file or all files |
|
||||
| **URL** | /file |
|
||||
| **Method** | DELETE |
|
||||
| ****URL Params**** | **Optional:**<br /> `filename=[string]` - file for deleting. <br /> *WARNING! Without this parameter, all files will be deleted* |
|
||||
| **Response** | **Code:** 200 OK <br /> **Success:**<br /> `{ "success": true }` |
|
||||
| **Sample** | **Delete one file:**<br />`curl -X DELETE http://localhost/file?filename=filename.docx`<br />**Delete all files:**<br />`curl -X DELETE http://localhost/file`<br /> |
|
||||
|
||||
|
||||
### GET `/files`
|
||||
|
||||
| | |
|
||||
| ------------------ | ------------------------------------------------------------ |
|
||||
| **Summary** | Get information about all files |
|
||||
| **URL** | /files |
|
||||
| **Method** | GET |
|
||||
| **Response** | **Code:** 200 OK <br /> **Success:**<br /> `[{ "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` |
|
||||
|
||||
## Important security info
|
||||
|
||||
Please keep in mind the following security aspects when you are using test examples:
|
||||
|
||||
@ -119,6 +119,46 @@ The following table shows the environment variables that is used to configure th
|
||||
|
||||
Check out the [Laravel documentation](https://laravel.com/docs/11.x/deployment#server-configuration) page in case you are having installation or configuration problems with the framework.
|
||||
|
||||
## File API methods used in this example
|
||||
|
||||
The methods described below are available for PHP Laravel test example.
|
||||
|
||||
### POST `/upload`
|
||||
|
||||
| | |
|
||||
| ---------------------- | ------------------------------------------------------------ |
|
||||
| **Summary** | Upload file to test example via request |
|
||||
| **URL** | /upload |
|
||||
| **Method** | POST |
|
||||
| **URL Params** | `user=[string]` - user id. |
|
||||
| **Request<br>Headers** | `Content-Type: multipart/form-data` |
|
||||
| **Request<br>Body** | `uploadedFile=@<filepath>`<br> `filepath` - file for uploading<br />Multipart body with the file binary contents |
|
||||
| **Response** | **Code:** 200 OK <br />**Content on success:**<br /> `{ "filename": <filename>}`<br />**Content on error:**<br /> `{ "error": "File type is not supported" }` <br /> Or <br /> `{ "error": "File size is incorrect" }` |
|
||||
| **Sample** | `curl -X POST -F uploadedFile=@filename.docx http://localhost/upload?user=uid-1` |
|
||||
|
||||
|
||||
### DELETE `/files/delete`
|
||||
|
||||
| | |
|
||||
| ------------------ | ------------------------------------------------------------ |
|
||||
| **Summary** | Delete one file or all files |
|
||||
| **URL** | /files/delete |
|
||||
| **Method** | DELETE |
|
||||
| ****URL Params**** | **Optional:**<br /> `filename=[string]` - file for deleting. <br /> *WARNING! Without this parameter, all files will be deleted* |
|
||||
| **Response** | **Code:** 200 OK <br /> **Success:**<br /> `{ "success": true }` |
|
||||
| **Sample** | **Delete one file:**<br />`curl -X DELETE http://localhost/files/delete?filename=filename.docx`<br />**Delete all files:**<br />`curl -X DELETE http://localhost/files/delete`<br /> |
|
||||
|
||||
|
||||
### GET `/files`
|
||||
|
||||
| | |
|
||||
| ------------------ | ------------------------------------------------------------ |
|
||||
| **Summary** | Get information about all files |
|
||||
| **URL** | /files |
|
||||
| **Method** | GET |
|
||||
| **Response** | **Code:** 200 OK <br /> **Success:**<br /> `[{ "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` |
|
||||
|
||||
## Security Info
|
||||
|
||||
Please keep in mind the following security aspects when you are using test examples:
|
||||
|
||||
@ -75,6 +75,56 @@ The example is configured by changing environment variables.
|
||||
| `EXAMPLE_URL` | The URL through which Document Server will communicate with the server. | `http://proxy` |
|
||||
| `JWT_SECRET` | JWT authorization secret. Leave blank to disable authorization. | `your-256-bit-secret` |
|
||||
|
||||
## File API methods used in this example
|
||||
|
||||
The methods described below are available for PHP test example.
|
||||
|
||||
### POST `/upload`
|
||||
|
||||
| | |
|
||||
| ---------------------- | ------------------------------------------------------------ |
|
||||
| **Summary** | Upload file to test example via request |
|
||||
| **URL** | /upload |
|
||||
| **Method** | POST |
|
||||
| ****URL Params**** | `user=[string]` - user id. |
|
||||
| **Request<br>Headers** | `Content-Type: multipart/form-data` |
|
||||
| **Request<br>Body** | `uploadedFile=@<filepath>`<br> `filepath` - file for uploading<br />Multipart body with the file binary contents |
|
||||
| **Response** | **Code:** 200 OK <br />**Content on success:**<br /> `{ "filename": <filename>}`<br />**Content on error:**<br /> `{ "error": "File type is not supported" }` <br /> Or <br /> `{ "error": "File size is incorrect" }` |
|
||||
| **Sample** | `curl -X POST -F uploadedFile=@filename.docx http://localhost/upload?user=uid-1` |
|
||||
|
||||
|
||||
### GET `/delete`
|
||||
|
||||
| | |
|
||||
| ------------------ | ------------------------------------------------------------ |
|
||||
| **Summary** | Delete one file |
|
||||
| **URL** | /delete |
|
||||
| **Method** | GET |
|
||||
| ****URL Params**** | `fileName=[string]` - file for deleting. |
|
||||
| **Response** | **Code:** 200 OK <br /> **Success:**<br /> `{ "success": true }` |
|
||||
| **Sample** | `curl -X GET http://localhost/delete?fileName=filename.docx` |
|
||||
|
||||
### DELETE `/delete`
|
||||
|
||||
| | |
|
||||
| ------------------ | ------------------------------------------------------------ |
|
||||
| **Summary** | Delete all files |
|
||||
| **URL** | /delete |
|
||||
| **Method** | DELETE |
|
||||
| **Response** | **Code:** 200 OK <br /> **Success:**<br /> `{ "success": true }` |
|
||||
| **Sample** | `curl -X DELETE http://localhost/delete` |
|
||||
|
||||
|
||||
### GET `/files`
|
||||
|
||||
| | |
|
||||
| ------------------ | ------------------------------------------------------------ |
|
||||
| **Summary** | Get information about all files |
|
||||
| **URL** | /files |
|
||||
| **Method** | GET |
|
||||
| **Response** | **Code:** 200 OK <br /> **Success:**<br /> `[{ "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` |
|
||||
|
||||
## Security Info
|
||||
|
||||
Please keep in mind the following security aspects when you are using test examples:
|
||||
|
||||
@ -76,6 +76,55 @@ The example is configured by changing environment variables.
|
||||
| `EXAMPLE_URL` | The URL through which Document Server will communicate with the server. | `http://proxy` |
|
||||
| `JWT_SECRET` | JWT authorization secret. Leave blank to disable authorization. | `your-256-bit-secret` |
|
||||
|
||||
## File API methods used in this example
|
||||
|
||||
The methods described below are available for Python test example.
|
||||
|
||||
### POST `/upload`
|
||||
|
||||
| | |
|
||||
| ---------------------- | ------------------------------------------------------------ |
|
||||
| **Summary** | Upload file to test example via request |
|
||||
| **URL** | /upload |
|
||||
| **Method** | POST |
|
||||
| **Request<br>Headers** | `Content-Type: multipart/form-data` |
|
||||
| **Request<br>Body** | `uploadedFile=@<filepath>`<br> `filepath` - file for uploading<br />Multipart body with the file binary contents |
|
||||
| **Response** | **Code:** 200 OK <br />**Content on success:**<br /> `{ "filename": <filename>}`<br />**Content on error:**<br /> `{ "error": "File type is not supported" }` <br /> Or <br /> `{ "error": "File size is incorrect" }` |
|
||||
| **Sample** | `curl -X POST -F uploadedFile=@filename.docx http://localhost/upload` |
|
||||
|
||||
|
||||
### GET `/remove`
|
||||
|
||||
| | |
|
||||
| ------------------ | ------------------------------------------------------------ |
|
||||
| **Summary** | Delete one file |
|
||||
| **URL** | /remove |
|
||||
| **Method** | GET |
|
||||
| ****URL Params**** | `fileName=[string]` - file for deleting. |
|
||||
| **Response** | **Code:** 200 OK <br /> **Success:**<br /> `{ "success": true }` |
|
||||
| **Sample** | `curl -X GET http://localhost/remove?fileName=filename.docx` |
|
||||
|
||||
### DELETE `/remove`
|
||||
|
||||
| | |
|
||||
| ------------------ | ------------------------------------------------------------ |
|
||||
| **Summary** | Delete all files |
|
||||
| **URL** | /remove |
|
||||
| **Method** | DELETE |
|
||||
| **Response** | **Code:** 200 OK <br /> **Success:**<br /> `{ "success": true }` |
|
||||
| **Sample** | `curl -X DELETE http://localhost/remove` |
|
||||
|
||||
|
||||
### GET `/files`
|
||||
|
||||
| | |
|
||||
| ------------------ | ------------------------------------------------------------ |
|
||||
| **Summary** | Get information about all files |
|
||||
| **URL** | /files |
|
||||
| **Method** | GET |
|
||||
| **Response** | **Code:** 200 OK <br /> **Success:**<br /> `[{ "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` |
|
||||
|
||||
## Security Info
|
||||
|
||||
Please keep in mind the following security aspects when you are using test examples:
|
||||
|
||||
@ -75,6 +75,45 @@ The example is configured by changing environment variables.
|
||||
| `JWT_SECRET` | JWT authorization secret. Leave blank to disable authorization. | `your-256-bit-secret` |
|
||||
| `PORT` | The port on which the server should be running. | `80` |
|
||||
|
||||
## File API methods used in this example
|
||||
|
||||
The methods described below are available for Ruby test example.
|
||||
|
||||
### POST `/upload`
|
||||
|
||||
| | |
|
||||
| ---------------------- | ------------------------------------------------------------ |
|
||||
| **Summary** | Upload file to test example via request |
|
||||
| **URL** | /upload |
|
||||
| **Method** | POST |
|
||||
| **Request<br>Headers** | `Content-Type: multipart/form-data` |
|
||||
| **Request<br>Body** | `uploadedFile=@<filepath>`<br> `filepath` - file for uploading<br />Multipart body with the file binary contents |
|
||||
| **Response** | **Code:** 200 OK <br />**Content on success:**<br /> `{ "filename": <filename>}`<br />**Content on error:**<br /> `{ "error": "File type is not supported" }` <br /> Or <br /> `{ "error": "File size is incorrect" }` |
|
||||
| **Sample** | `curl -X POST -F uploadedFile=@filename.docx http://localhost/upload` |
|
||||
|
||||
|
||||
### DELETE `/remove`
|
||||
|
||||
| | |
|
||||
| ------------------ | ------------------------------------------------------------ |
|
||||
| **Summary** | Delete one file or all files |
|
||||
| **URL** | /remove |
|
||||
| **Method** | DELETE |
|
||||
| ****URL Params**** | **Optional:**<br /> `filename=[string]` - file for deleting. <br /> *WARNING! Without this parameter, all files will be deleted* |
|
||||
| **Response** | **Code:** 200 OK <br /> **Success:**<br /> `{ "success": true }` |
|
||||
| **Sample** | **Delete one file:**<br />`curl -X DELETE http://localhost/remove?filename=filename.docx`<br />**Delete all files:**<br />`curl -X DELETE http://localhost/remove`<br /> |
|
||||
|
||||
|
||||
### GET `/files`
|
||||
|
||||
| | |
|
||||
| ------------------ | ------------------------------------------------------------ |
|
||||
| **Summary** | Get information about all files |
|
||||
| **URL** | /files |
|
||||
| **Method** | GET |
|
||||
| **Response** | **Code:** 200 OK <br /> **Success:**<br /> `[{ "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` |
|
||||
|
||||
## Security Info
|
||||
|
||||
Please keep in mind the following security aspects when you are using test examples:
|
||||
|
||||
Reference in New Issue
Block a user