Community articleDeleting a file attachment
Added by IBM contributorIBM on March 25, 2014
Rate this article 1 starsRate this article 2 starsRate this article 3 starsRate this article 4 starsRate this article 5 stars

Removes a file attachment from a file. An attachment is also indirectly deleted when the file it is associated with is deleted.



Removes a file attachment from a file. An attachment is also indirectly deleted when the file it is associated with is deleted.

This request requires authentication. To delete an attachment, the currently authenticated user must be the owner of the user library containing the document, an administrator, or have been shared with as a document editor. To test whether the current user can delete a file attachment, use the Retrieving file metadata API with the acls parameter set to "true ", and check the <td:permission> element for the Delete flag.

See Authenticating requests for information about how to authenticate the request.

Note: {document-id} is the value of the <td:uuid> or <td:label> element in the Atom entry document of the file with the attachment. {attachment-id} is the value of the <td:uuid> or <td:label> elements in the attachment's Atom entry document.

You can use the following header.

Provide the following required input parameter.

Input

None.

Output

None.

Input
Method URI Description
DELETE /files/basic/api/myuserlibrary/document/{document-id}/attachment/{attachment-id}/entry Removes a file attachment from a file.
Name Type Optional Description
document-id
string No {document-id} is the value of the <td:uuid> or <td:label> element in the Atom entry document of the file with the attachment.
attachment-id
string No {attachment-id} is the value of the <td:uuid> or <td:label> elements in the attachment's Atom entry document.
Name Type Optional Description
identifier
string Yes Indicates how the document is identified in the {document-id} variable segment of the web address. By default, the lookup operation is performed with the expectation that the URL contains the value from the <td:uuid> element of a attachment Atom entry, so the value uuid is used. Specify label if the URL instead contains the value from the <td:label> element of a attachment Atom entry. This parameter is required.
Name Type Optional Description
X-Method-Override
string Yes Tunnels a DELETE request over the HTTP POST request.
X-Update-Nonce
string Yes String. Represents a unique data string generated by the server upon request that you can provide to secure the request. See Getting a nonce key for information about how to request the data string.
Output
Code Description
204
Indicates that the file was successfully removed from the collection.
401
Unauthorized.
403
Forbidden.
404
Not Found.