Delete a file attachment
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 Retrieve 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.
Table 1. Atom API request details
Method URI Input and output representations DELETE /basic/api/myuserlibrary/document/{document-id}/attachment/{attachment-id}/entry none
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.
Table 2. Input header
Parameter Description X-Method-Override Tunnels a DELETE request over the HTTP POST request. Provide the following required input parameter.
Table 3. Input parameter
Parameter Description identifier 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.
Input
None.
Output
None.Returned HTTP headers
HTTP/1.1 204 No Content
Indicates that the file was successfully removed from the collection.
- HTTP/1.1 401 Unauthorized
- HTTP/1.1 403 Forbidden
- HTTP/1.1 404 Not Found
Parent topic
Work with file attachments programmaticallyRelated reference
File attachment content
});