cancel
Showing results for 
Search instead for 
Did you mean: 

How to delete the main file linked to document (type Picture) via REST API and its thumbnails?

Antonio_Pescion
Confirmed Champ
Confirmed Champ

How to delete the main file linked to document (type Picture) via REST API and its thumbnail?

I want to delete it because I have to change it by onother one through PUT update of content:file

1 REPLY 1

Not applicable

Hi Antonio,

You can try the following solution on API playground:

POST <Nuxeo URL>/nuxeo/site/automation/Document.RemoveProperty

with raw-body:

{
   "input": "<documentId>",
   "params": {
        "xpath": "files/content"
   }
}

Alternatively, you can run the following code using Node.js and Nuxeo JS Client:

#!/usr/bin/env node
const Nuxeo = require('nuxeo');
const nuxeo = new Nuxeo({
  auth: {
    method: 'basic',
    username: 'Administrator',
    password: 'Administrator'
  }
});

nuxeo.operation('Blob.Remove')
.input('/default-domain/path/to/my/picture')
.execute()
.then(function(res) {
})
.catch(function(error) {
  throw new Error(error);
});

I tested these two solutions on a Picture document and both worked for me. I hope that helps.