Deleting annotations

You use the HTTP DELETE request to delete an annotation for an object. You cannot delete annotations for old versions of an object.

Access permission

To delete an annotation, you need delete permission.

Request header

DELETE /rest/directory/file?type=custom-metadata&annotation=annotation HTTP/1.1
ParameterRequiredDescription
directoryYesFolder name.
fileYesName of the file, including file extension.
typeYesUse the value custom-metadata.
annotation NoUse a value of the name of the annotation. You can omit this parameter for the default annotation.Used in conjunction with the type parameter.

Response headers

This operation does not return any request-specific response headers.

Return codes

The table below describes the HTTP return codes that have specific meaning for this request.

CodeMeaningDescription
200OKHCP successfully deleted the annotation.
204No ContentThe specified object does not have the specified annotation.
400Bad Request

The request specified a conditional header, such as If-Match.

If more information about the error is available, the HTTP response headers include the HCP-specific X‑HCP-ErrorMessage header.

403Forbidden

One of:

  • The Authorization header or hcp-ns-auth cookie specifies invalid credentials.
  • The namespace requires client authentication, and the request does not have an Authorization header or hcp-ns-auth cookie.
  • The user doesn’t have delete permission.
  • The object is under retention, and the namespace does not allow deleting custom metadata for objects under retention.
  • The access method (HTTP or HTTPS) is disabled.

If more information about the error is available, the response headers include the HCP-specific X‑HCP-ErrorMessage header.

404Not Found

One of:

  • HCP could not find an object or version at the specified URL. The specified object or version does not exist, or the request specified the current version of an object that has been deleted.
  • The URL path contains a symbolic link to a directory anywhere other than in the last component.
409ConflictHCP could not delete the annotation because it is currently being written to the namespace.

Example: Deleting an annotation for an object

Here’s a sample HTTP DELETE request that deletes the report_data annotation for an object named Q1_2012.ppt located in the quarterly_rpts directory.

Request with curl command line

curl -k -iX DELETE
    -H "Authorization: HCP bXl1c2Vy:3f3c6784e97531774380db177774ac8d"
    "https://finance.europe.hcp.example.com/rest/quarterly_rpts/Q1_2012.ppt
    ?type=custom-metadata&annotation=report_data"

Request in Python using PycURL

import pycurl
curl = pycurl.Curl()
curl.setopt(pycurl.HTTPHEADER, ["Authorization: HCP
  bXl1c2Vy:3f3c6784e97531774380db177774ac8d"])
curl.setopt(pycurl.URL, "https://finance.europe.hcp.example.com \
  /rest/quarterly_rpts/Q1_2012.ppt?type=custom-metadata \
  &annotation=report_data")
curl.setopt(pycurl.SSL_VERIFYPEER, 0)
curl.setopt(pycurl.SSL_VERIFYHOST, 0)
curl.setopt(pycurl.CUSTOMREQUEST, "DELETE")
curl.perform()
print curl.getinfo(pycurl.RESPONSE_CODE)
curl.close()

Request headers

DELETE /rest/quarterly_rpts/Q1_2012.ppt?type=custom-metadata
&annotation=report_data HTTP/1.1
Host: finance.europe.hcp.example.com
Authorization: HCP bXl1c2Vy:3f3c6784e97531774380db177774ac8d

Response headers

HTTP/1.1 200 OK
X-HCP-ServicedBySystem: hcp.example.com
X-RequestId: E62EFD408DBB7B8F
X-HCP-Time: 1334829227
Content-Length: 0