Use the DELETE /files{/path/to/a/file}
transaction to delete a file or a folder from the user's storage area.
A successful transaction return object contains the status flag and a message, as shown below.
{ "ok" : true, "status": "test/today/test123.txt has been deleted" }
If the target does not exist or cannot be deleted, the transaction returns an object containing a false
flag and a message, as shown below.
{ "ok" : false, "status": "test/today/test123.txt is not found or cannot be deleted" }
Send the /user
command using curl:
curl -b cookies -X DELETE https://api.ensims.com/users/api/test/today/test123.txt
On success, the contents of the file are returned. If the existing JWT is invalid, an HTTP 401 Unauthorized code will be returned.
Make sure Requests is correctly installed in your Python environment, and run the following lines:
import requests # Existing cookies are expected to be stored in the variable 'cookies' r = requests.delete('https://api.ensims.com/users/api/files/test/today/test123.txt', cookies=cookies) # Show the returned object r.json()