Skip to main content

How can I delete an image via the API? (Programmable Media)

Comments

13 comments

  • Gregg Setzer

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

    0
  • 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
  • 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
  • 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
  • Levar Berry

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

    0
  • 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
  • osmel

    its possible delete it without callback?how?

    0
  • 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
  • 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
  • cristian ditoiu

    Unfortunately the bulk delete interface does nothing....

    Resource Search Criteria:
    Resources: Original and derived
    Search by: Date older than 1 month

    0 resources were deleted ( 0 original and 0 derived ).

     
    0
  • Aleksandar Kostadinov

    Hi Cristian,

    This article was referring to the Programmable Media Product which was before Media Optimizer (which is the account type you have). With Media Optimizer there is no Storage component of assets on Cloudinary as the images are only cached on Cloudinary but not strictly stored there as with Programmable Media. Therefore, accessing and running a Bulk Delete for a Media Optimizer account has no effect and the output you received is expected. I have updated the Knowledge Base so that it explicitly mentions that this is relating to the Programmable Media product to avoid confusion in future. I also see that you raise a ticket directly with us regarding this topic so I've also replied there.

    0
  • cristian ditoiu

    ummm ok...and how on earth can i tell cloudinary to fetch the data (images/video/whatever again) without going through all urls manualy ? 

    [root@frinks ~]# curl https://xxxx:xxxx@api-eu.cloudinary.com/v1_1/frincks-cdn/resources/image

    gives me (with the correct credentials:) 

    {"error":{"message":"Media Optimization Customer doesn't have sufficient permissions to access this endpoint"}}

    0
  • Aleksandar Kostadinov

    Hi Cristian,

    I just replied in the direct ticket but I'll also include the response below for reference:

    There's an issue on our side with the message returned from the API and the endpoint recommended for use via Media Optimizer when your cloud's region is either in EU or AP. In your case, the endpoint you will want to use is https://mo-api-eu.cloudinary.com.

    0

Please sign in to leave a comment.