Cloudinary's Admin API allows you to delete up to 1000 derived assets based on a given transformation, with a single call.
Let's assume your account has several assets, which you previously generated derived assets for, using the following transformation:c_thumb,g_face,h_150,w_150
.
Using one of our SDKs, you can delete both the transformation and its derivatives in one go using the Admin API Delete transformation method.
You can either make the call based on the transformation name or by specifying the transformation parameters.
Examples
Delete transformation by name:
Node.JS:
cloudinary.v2.api.delete_transformation('c_thumb,g_face,h_150,w_150
')
.then(result=>console.log(result));
Python:
res = cloudinary.api.delete_transformation("c_thumb,g_face,h_150,w_150
")
DotNet:
res = cloudinary.DeleteTransform("c_thumb,g_face,h_150,w_150
");
PHP:
$res = $api->deleteTransformation("c_thumb,g_face,h_150,w_150
");
Java:
res = api.deleteTransformation("c_thumb,g_face,h_150,w_150
", ObjectUtils.emptyMap());
Ruby:
res = Cloudinary::Api.delete_transformation('c_thumb,g_face,h_150,w_150
')
Go:
resp, err := cld.Admin.DeleteTransformation(ctx, admin.DeleteTransformationParams{Transformation: "c_thumb,g_face,h_150,w_150
"})
Delete transformation by parameters
Node.JS:
cloudinary.v2.api.delete_transformation({width: 150, height: 150, crop: 'thumb', gravity: 'face'})
.then(result=>console.log(result));
Python:
res = cloudinary.api.delete_transformation(dict(width = 150, height = 150, crop = "thumb", gravity = "face"))
PHP:
$res = $api->deleteTransformation(["width" => 150, "height" => 150, "crop" => "thumb", "gravity" => "face"]);
Java:
res = api.deleteTransformation(new Transformation().width(150).height(150).crop("thumb").gravity("face").generate(), ObjectUtils.emptyMap());
Ruby:
res = Cloudinary::Api.delete_transformation(width: 150, height: 150, crop: "thumb", gravity: "face")
The Admin API is rate-limited, hence every call made counts towards your hourly quota.
N.B
- This method is only supported if there are up to 1000 derived assets to delete.
- Like any other Admin API call, the API Secret is required, therefore it should only be called from the server side.
Comments
0 comments
Please sign in to leave a comment.