How to delete images from cloudinary

Hai
I want to delete images from coludinary. When I try from nodejs it is working but from thunkable it is not working. I get page not found error in title tag.
This is what I used. I also tried without timestamp.

2 Likes

Is a POST appropriate here, or is Cloudinary expecting a GET?

2 Likes

Yes, it should be POST.

[Edit]
I checked the documentation and following are two samples to delete an image and a video.

curl https://api.cloudinary.com/v1_1/demo/image/destroy -X POST --data 'public_id=sample&timestamp=173719931&api_key=436464676&signature=a788d68f86a6f868af'
curl https://api.cloudinary.com/v1_1/demo/image/destroy -X POST --data 'public_id=sample&resource_type=video&timestamp=173719931&api_key=436464676&signature=a788d68f86a6f868af'

You will need to manually generate the signature using SHA-1 hashing to be able to complete the process.

The signature should consist of:

  • Public_id
  • Timestamp
  • Secret key
    and it should be in this order using = between the parameter and the value and & between each pair but not the secret key

I also noticed from the examples above that these should go into body query not command line parameters.

If my observation is correct then the image of the Web API given in the first post should not work.

3 Likes

Thanks for reply.
I changed to body all parameters like this .
Now also I get the same error.


I took the time stamp from url uploaded by mediaDB.

1 Like

Try to use this as the URL:

https://api.cloudinary.com/v1_1/CLOUD_NAME/image/destroy

For me, this way works:

1 Like

I tried something like this but not working

Is XX your cloud name?

What is the response/error message?

I get a long message. In title it shows page not found.

here xx represents my cloud name.

The key of solving this topic could be in the error message. Please copy it here.

this is the link for a sample please check it out.
https://x.thunkable.com/copy/41b227eac48d9f0c75fc1e9d9bf26660

As I mentioned before, you are using a bad URL in the URL field:

Don’t forget the /v1_1/ part. Let me know if it does work.

1 Like

The documentation refers to the URL @skulamester mentioned and does not give any reference to the other URL used by @arleen

I changed signature property directly string like this


now i get this error
“error”: {

    "message": "Invalid Signature kqb8gbway27wvmqvrspdt-fdjms. String to sign - 'public_id=y5b9oqtyqge6z3m2wwhf&timestamp=1626015856'."

I copied all parameters from cloudinary, I don’t know what’s the wrong.
Thanks.

1 Like

Is that signature the result of hashing public_id=y5b9oqtyqge6z3m2wwhf&timestamp=1626015856 PLUS your api secret , as described here?
https://cloudinary.com/documentation/upload_images#generating_authentication_signatures

1 Like

You have to create a signature, see this:

1 Like

I tried for hours but I could not figure out my problems. I am a beginner.
Can you please write the correct code block.
this is the link of sample I am trying.
https://x.thunkable.com/copy/1af8f723740991379c4bf1fa63b56270
uploading also not working.
Thanks

1 Like

You should be able to get uploading working without having to call the API - there’s sample code here:

I’m going to ask my same question again - how did you hash your signature string? Looking at your project, I don’t see where you pass in the string to be hashed for the first API call. That might be an artifact of the copying process, but if not, that’s definitely a problem.

1 Like