You use the HTTP DELETE method to delete an empty directory from a namespace. You cannot delete a directory that contains any objects, subdirectories, or symbolic links.
Access permission
To delete a directory you need delete permission for the namespace.
Request header
DELETE /rest/directory/empty_dir HTTP/1.1
Parameter | Required | Description |
---|---|---|
directory | Yes | Folder name. |
empty_dir | Yes | Name of the empty directory that you want to delete. |
Response header
This operation does not return any request-specific response headers.
Response body
Not applicable
Status codes
The table below describes the HTTP status codes that have specific meaning for this request.
Code | Meaning | Description |
---|---|---|
200 | OK | HCP successfully deleted the directory. |
404 | Not Found |
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. |
403 | Forbidden |
One of:
If more information about the error is available, the response headers include the HCP-specific X‑HCP-ErrorMessage header. |
404 | Not Found |
One of:
|
409 | Conflict | HCP could not delete the specified directory because the directory is currently being written to the namespace. |
Example: Deleting an empty directory
Here’s a sample HTTP DELETE request that deletes the directory named obsolete from the quarterly_rpts directory in the namespace.
Request with curl command line
curl -k -iX DELETE -H "Authorization: HCP bXl1c2Vy:3f3c6784e97531774380db177774ac8d" "https://finance.europe.hcp.example.com/rest/quarterly_rpts/obsolete”
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/obsolete") 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/obsolete 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-HCP-Time: 1334829227 Content-Length: 00