Delete Attachments through API

Hi All,

I am not able to delete attachments through API. When i use Blob.RemoveFromDocument from API it only deleted the contents of file but not the entry of that attachment.
Can anyone help me on this issue.

0 votes

1 answers



Hi Kartik,

Both Blob.Remove and Document.RemoveProperty are, basically, the same. The difference is Blob.Remove has default “xpath” parameter with default value “file:content”. I think you are asking about delete attachments of document, so for that, you need to make your request with the payload with correct params with xpath of file attachment, for example, to delete the first attachment of your-doc-id document:

POST $HOST/nuxeo/site/automation/Blob.Remove
POST $HOST/nuxeo/site/automation/Document.RemoveProperty

With raw-body:

   "input": "your-doc-id",
   "params": {
        "xpath": "files/content[0]"

I hope this helps, VS!

0 votes

Hi Victor,

Thanks for the answer. But i am facing problem to delete specific attachment. When i try the way you have explained it is deleting the last attachment of the array. I am not able to send the attachment number which i want to delete. Could you help me on this issue.



Did you launch your request with another index of "xpath":"files/content[k]" with 0 <= k < number_of_attachments? I am testing with several attachments and they are removing properly.

Scenario:I have an asset with 5 attachments to it and i want to delete for example attachment number 3. That is k=2(as k ranges from 0 to 4 when count is 5). What ever value i pass to k it is deleting the last attachment in the list.

Any solution to this?