Delete raw files is not working
Hi,
I'm trying to delete a raw file using the Java SDK without any success.
Here my simple code that I used to delete using the SDK:
Map options = ObjectUtils.asMap(Invalidate,
Boolean.box(true),
ResourceType,
"raw,
"type",
"upload"
);
val result =
client.uploader().destroy(fileName, options);
And for a raw file I'm getting a not found error, from the Admin API I see for example:
curl --location --request POST 'https://api.cloudinary.com/v1_1/test-seecommerce/raw/destroy' \
--header 'Authorization: Basic e3tVc2VybmFtZX19Ont7UGFzc3dvcmR9fQ==' \
--form 'public_id="test.txt"' \
--form 'signature="35f5b0218a5783f43b061968bf1cab96371da399"' \
--form 'api_key="427165244618575"' \
--form 'timestamp="1652189038571"'
{"result":"ok"}%
-
Hi there,
I checked our logs and I couldn't see a failed destroy request for the public id "it/test.txt". I am thinking it didn't reach us. I noticed in your code that the value "raw" is missing a double quote to enclose the value.
Another thing that you could try is to hard code the public id to make sure you are passing the correct value.
You could try this code:Map options = ObjectUtils.asMap("invalidate",true,
"resource_type","raw",
"type","upload");
result = client.uploader().destroy("it/test.txt", options);
Please let me know how it goes.
Thanks,
Francis -
Hi Alberto,
Yes, I intentionally hardcoded the strings to make sure the values are correct.
I checked your account to see the resource `it/doc`. This asset is a pdf file and it was uploaded with resource_type `raw`. Please note that for `raw` files, the file extension is included in the public id.Could you please use the public id "it/doc.pdf" in your destroy request? Please let me know the results.
Regards,
Francis
Post is closed for comments.
Comments
3 comments