Force refresh / invalidate CDN cache of a fetched image

Comments

4 comments

  • Avatar
    Raz Ziv

    Hi Julien,

    By default, the bulk delete method of our Admin API delete_resources() does not allow invalidations.

    If you need to delete and invalidate a single resource, you can and should use the destroy() method of the Upload API, while including the 'invalidate' => true parameter in your request, the same way you did in your example when trying to invalidate via the delete_resources() method.

    However, as you've already deleted the resource, you won't be able to delete it again with destroy.
    Therefore, please share with me the relevant URL for the fetched image and I will invalidate it for you manually.

    Best,
    Raz

    0
    Comment actions Permalink
  • Avatar
    Julien_G

    Hi Raz,

    With Upload Api everything is now working as expected.

    No need to worry about previous deleted images, it was only for testing purpose.

    Thank you very much for your answer, great support :)

    Julien

     

     

    0
    Comment actions Permalink
  • Avatar
    アクトネット 斉藤様

    Hi Raz,
    I am fetching as url (https://res.cloudinary.com/<cloud_name>/image/fetch/d_no_image_560_sesesk.png,f_webp,q_auto:good/f_webp/https://asia.olympus-imaging.com/content/000107506.jpg) and have a look at destroy() method but it is asking for signature, how do I get the signature in my case or is there any other way to refresh the fetched image?
    Thank you !

    0
    Comment actions Permalink
  • Avatar
    Zachary Gould

    Hey there, 

    Sorry, we have had some recent issues with our forum system and unfortunately, we were unaware of your last question. I want to make sure you've gotten the information you needed to progress in your project.

    By far the easiest method to generate a signature is utilizing one of our SDKs, Cloudinary provides comprehensive API client-libraries in order to save you the hassle of generating the HTTP request and the signature by yourself.

    If you still require doing that on your own, you might want to check out how it's done on our client libraries. Below are some references to start from:

    Ruby On Rails:

    api_sign_request(params_to_sign, api_secret)

    PHP:

    \Cloudinary::api_sign_request($params_to_sign, $api_secret)

    Node JS:

    api_sign_request = function(params_to_sign, api_secret)

    Java:

    apiSignRequest(Map<String, Object> paramsToSign, String apiSecret)

    Django:

    api_sign_request(params_to_sign, api_secret)

    .NET:

    SignParameters(IDictionary<string, object> parameters)

    CLI:

    cld utils api_sign_request $params_to_sign $api_secret

    Few more tips:

    1. The string to sign must consist of a valid Timestamp (UNIX format), your account's api_secret and any additional upload parameter in use exceptfilecloud_nameresource_type and your api_key.
    2. String to sign must contain all required parameters sorted alphabetically, where the parameter names are separated from their values with an = and the parameter/value pairs are joined together with an & , and end with the api_secret.
    3. api_secret should never be revealed to anyone who is not authorized, therefore should never be used on the client-side or inside your native application.
    4. Mobile native applications must either use an unsigned-upload or have a server to process the signature on.
    5. A signature is only valid for 1 hour since the timestamp it's based on.
    6. Sanity check - Signing the following string:
      "public_id=sample_image&timestamp=1315060510abcd"
      where `abcd` is the api_secret, should result in the following signature:
      "b4ad47fb4e25c7bf5f92a20089f9db59bc302313"
    7. More information is available here:
      https://cloudinary.com/documentation/upload_images#generating_authentication_signatures
    0
    Comment actions Permalink

Please sign in to leave a comment.