Rename File(not image) from .NET
Hi,
I am trying to rename a file, but it doesn't work
I tried this:
var cloudinary = new Cloudinary(GetCloudinaryAccount());
cloudinary.Rename(oldPublicId, newPublicId);
This works on images, but doesn't work on files
I read this
So I tried to do similar, but it looks like the API doesn't support resource_type, because cloudinary's RenameParams doesn't have that property.
I tried to do this:
var cloudinary = new Cloudinary(GetCloudinaryAccount());
var rename_parameters = new RenameParams(oldPublicId, newPublicId);
var url = cloudinary.Api.ApiUrlImgUpV.ResourceType(Api.GetCloudinaryParam<ResourceType>(ResourceType.Raw)).Action("rename").BuildUrl();
SortedDictionary<string, object> renparams = rename_parameters.ToParamsDictionary();
HttpWebResponse response = cloudinary.Api.Call(HttpMethod.POST, url, renparams, (FileDescription)null);
This returns stats:404
and I tried to add resource_type parameter like this
this.AddParam(renparams, "resource_type", "raw");
this returns status 401 Invalid signature
how could I rename Non-image files in .NET?
thanks
-
Hi Banks,
Thanks for reaching out.
It does seem like we have an issue with renaming non-image types in .NET SDK.
There's already an issue open to fix it. I'll of course let you know of any updates.
As a workaround, you can rename using a direct call to the API -
https://api.cloudinary.com/v1_1/<cloud_name>/<resource_type>/rename
Let me know if you need any further assistance with building this call.
Best,
0 -
Hi Banks,
Wanted to let you know that our .NET SDK was updated and it now supports setting a ResourceType in RenameParams.
You can find the SDK here -
https://github.com/cloudinary/CloudinaryDotNet
Give it a try and let me know how it goes?
Thanks,
0 -
thanks Maor,
When do you think it will be available via NuGet ?
Thanks
0
Post is closed for comments.
Comments
3 comments