Conflict between forced save and automatic save

I want to close the page without automatically saving modifications to the document; So I cancelled the automatic save, but after canceling it, the newly added external button called the forced save, and the forced save interface returned: {error: 4, key: “ac067bc433ec6b5b”}, unable to successfully save the document. May I ask if there is a suitable solution

Hello @wangshaopeng

Please provide more details as your description is quite unclear:

  • what are you trying to achieve when closing a doc without changes?
  • what do you mean by ‘automatic save’ and how did you disable it?
  • what does your ‘external button’ do and where it is located?

In general, please take a look at the description of how you can invoke Forcesave from our API:
https://api.onlyoffice.com/editors/save#forcesave

  1. After editing the document, I clicked on the close button in position 2 and wanted the document server to not save the changes I made

  2. Therefore, I cancelled the startup save as shown in picture 2

  3. After step 2, click the save button at position 1 in picture 1. The button here calls my application server, and the application server calls the forced save interface of the document server. At this time, the forced save interface returns {error: 4, key: “ac067bc433ec6b5b”}, and the edited document is not saved successfully

Your description does not tell what exactly your external Forcesave button does. Moreover, it is not clear what happens after you close the document - do you terminate current editing session?

Indeed, Autosave in Advanced settings is used to turn on/off automatic saving of changes you make while editing, i.e. to send changes to the Document Server and not to save the file completely back to storage.

Forcesave in its turn is used to save the document to the storage while file is being edited, i.e. without terminating editing session.

According to the provided description, or at least how you describe it, there is no need to use Forcesave in your usage scenario as the document is getting closed and editing session is terminated. From that perspective regular saving of a file should be used:

In addition, this error is returned when no changes were applied to the document before the forcesave command is invoked. You can check all error codes in the end of this page:

Since you are not sending any changes to Document Server during the editing (disabled it by Autosave setting), Forcesave basically cannot get the changes made to the document as they are not sent to Document Server to save it back to the storage.