How can I delete an image via the API?

Follow

Comments

9 comments

  • Avatar
    Gregg Setzer

    For those interested in the Admin API usage limits. http://cloudinary.com/documentation/admin_api#protocol_and_authentication > Usage Limits.

    0
    Comment actions Permalink
  • Avatar
    Chetan Kantharia

    I am trying to delete with REST API (https://cloudinary.com/documentation/image_upload_api_reference#destroy)

    But I am getting Error

    ```

    {
    "error": {
    "message": "Invalid Signature 2cfb6ad66a0c6f00713f58e2eafaecfdd92XXXXX. String to sign - 'public_id=hf23hjp7swkslsih3dfd&timestamp=1502454673000'."
    }
    }

    ```

     

    1
    Comment actions Permalink
  • Avatar
    Aditi Madan

    Hi Chetan,

    Can you please open a support ticket here-https://support.cloudinary.com/hc/en-us/requests/new with your account details and the URL of the resource you are trying to delete and we will be able to reproduce the issue.

    Also, you can check our signature generation doc here for more details-https://cloudinary.com/documentation/upload_images#generating_authentication_signatures

    0
    Comment actions Permalink
  • Avatar
    Joel Milne

    The example code is missing the err parameter to the callback before result. This code will log the error, not the result. Should be: 

    cloudinary.uploader.destroy('zombie', function(err, result) { console.log(result) });
    0
    Comment actions Permalink
  • Avatar
    Levar Berry

    What is zombie?   How you insert the file you want to delete?   Do you put in the full URL? the Path ???

    0
    Comment actions Permalink
  • Avatar
    Roee Ben Ari

    Hi Berry, 'zombie' is the public_id (i.e., its name) of the image. 

    Here's a link to the docs:
    https://cloudinary.com/documentation/image_upload_api_reference#destroy_method

    0
    Comment actions Permalink
  • Avatar
    osmel

    its possible delete it without callback?how?

    0
    Comment actions Permalink
  • Avatar
    Aleksandar Kostadinov

    Hi Osmel,

    The callback is needed only in NodeJS because it's asynchronous. In the callback, you would access the response received for the API call you performed. Other Cloudinary SDKs, such as Ruby, PHP or Python don't use callbacks as they are not relevant for those languages.

    Are you currently using NodeJS in your application? Could you share more details as to why you cannot use callbacks or what issue you are encountering?

    0
    Comment actions Permalink
  • Avatar
    osmel

    Hi aleksandar, I did it using a callback and it works perfectly, with your explanation it is now clear to me, thanks for the help

    0
    Comment actions Permalink

Please sign in to leave a comment.