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

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

0 votes

1 answers

2019 views

ANSWER



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.

0 votes