Saveediting API Not Working

Do you want to: Report a bug
DocSpace version: 3.0.4.1
OS: Docker
Browser version: Chrome

curl -L -X PUT 'http://localhost/api/2.0/files/file/5/saveediting' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: ********' \
-d '{
  
  "downloadUri": "https://imfile.melinked.com/2025/03/39792cb1-8437-45d4-9869-b247601d05d8.docx",
  "forcesave": true
}'

I executed the command to store the file, but when I opened the file, its content had turned into the parameter I passed. It didn’t store the file correctly.

public boolean saveFile(int fileId, String token, String downloadUri) throws Exception {
        String url = BASE_URL + "/api/2.0/files/file/" + fileId + "/saveediting";

        CloseableHttpClient client = HttpClients.createDefault();
        HttpPut httpPut = new HttpPut(url);

        JSONObject jsonObject = new JSONObject();
        jsonObject.put("downloadUri", downloadUri);
        jsonObject.put("forcesave", true);

        StringEntity entity = new StringEntity(jsonObject.toString(), "UTF-8");
        entity.setContentType("application/json");
        httpPut.setEntity(entity);
        httpPut.setHeader("Authorization", token);
        HttpResponse response = client.execute(httpPut);
        String responseString = EntityUtils.toString(response.getEntity());
        System.out.println(responseString);

        return response.getStatusLine().getStatusCode() == 200;

    }

The result of executing this Java code is also incorrect.

curl -L -X PUT 'http://localhost/api/2.0/files/file/5/saveediting' \
-H 'Content-Type: multipart/form-data' \
-H 'Accept: application/json' \
-H 'Authorization: ******' \
-F 'FileExtension=.docx' \
-F 'File=@1.docx' \
-F 'Forcesave=true'

The result of executing this Java code is also incorrect."

Hello @Annisun
Thank you for the provided details, we are checking the situation.

Hello @Annisun
Please accept our sincere apologies for the situation, the description of the ’ Save file edits’ is incorrect, the default behavior for this method is to overwrite data in a file.
We are going to review documentation, thank you for pointing us to this situation!

Additionally, please clarify your final goal. If it’s possible, please describe the entire scenario, and we will check which methods could help you achieve it.