cancel
Showing results for 
Search instead for 
Did you mean: 

Delete Attachments through API

kartik_sn
Confirmed Champ
Confirmed Champ

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.

Regards
1 ACCEPTED ANSWER

Victor_Sánchez
Confirmed Champ
Confirmed Champ

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!

View answer in original post

4 REPLIES 4

Victor_Sánchez
Confirmed Champ
Confirmed Champ

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!

Hi Victor,

Did you launch your request with another index of "xpath"

Scenario