Image not getting deleted

kgoyal
kgoyal Member Posts: 1
edited September 27 in Developer APIs

I am trying to delete an image. It says that the image is not found but it still opens on the cloudinary_url.

>>> cloudinary.uploader.destroy("user_cls1hjqjd00004enqgohyclng_profile_image")
{'result': 'not found'}
>>> cloudinary.utils.cloudinary_url("user_cls1hjqjd00004enqgohyclng_profile_image")
('https://res.cloudinary.com/dqpdbfczw/image/upload/user_cls1hjqjd00004enqgohyclng_profile_image', {})

Tagged:

Answers

  • Vdeub
    Vdeub Member, Cloudinary Staff Posts: 70

    Hi @kgoyal,

    The cloudinary.utils.cloudinary_url is just an URL builder so it doesn't mean that while it generates a URL, the URL will actually resolved. In your case, the URL throws a 404 because effectively your asset is already deleted and doesn't exist in Cloudinary anymore.

    Instead of using the method you share, you can:

    • Use the Admin API to see if the resource exists
    • Look directly in your Cloudinary Media Library

    Hope that helps.

    Best,

    Loic