cloudinary.v2.create_folder does not exist
In Admin API documentation I can clearly read that to create a folder I can use: `
cloudinary.v2.api.create_folder(folder, callback);
`
But cloudinary.v2.api doesn't contain create_folder method. There are delete_folder but not create_folder.
Am I missing something?
-
Hi Yaroslav,
The API endpoint for creating the folders exists, however, as you've noted not all SDKs have had the method implemented yet.
By default, folders are automatically created if they don't exist but are specified as part of an upload API call for example. Is there any reason you'd need to create them ahead of time?
Best regards,
Aleksandar
1 -
Hi Aleksandar,
yes, I can create a folder by using the restful endpoint, but I would like to use SDK for all cloudinary requests.
The reason I need to create a folder upfront is that I am creating a folder per post. That folder should contain assets for that post. The author of the post should have access only to assets in that folder. That means I need to create an asset folder when the author creates a post.Thank you
0 -
Hi Yaroslav,
Thanks for sharing some more details on your use-case.
Rather than using the REST API endpoint directly what I meant is that by default Cloudinary will create a folder for you if it doesn't exist but is specified in an upload API call when uploading an asset. This is an option defaulted to enabled within each account in the Settings -> Upload tab:

For example, if my account doesn't have a folder called "Test" but I then send an Upload API call to upload sample.jpg and specify either the "public_id" parameter to "Test/sample" or "public_id" to "sample" and also include the "folder" param and set it to "Test" then the system would automatically create that folder for me and upload the asset inside.
In your case, once you create a new post you would know what folder you need rather than creating it explicitly then uploading the asset inside you can just add the folder to the "public_id" or the "folder" parameter and we'll create that folder at the same time as the upload if it doesn't exist. If the folder already exists then we'll just upload the asset inside it.
Would that work for you?
Best regards,
Aleksandar
0 -
I need to have the folder created before the first upload because I want to use the Media Library widget so my users can manage the files that they upload. The documentation states that there should be a CreateFolder method.
I am trying to use the .NET API on ASP .NET Core.
0 -
Hi Daniel,
Looking at the relevant tickets on our end for this API change, the documentation has indeed been updated ahead of time. The Ruby, Python and PHP SDKs have also been updated to include that method, while the Java, .NET and NodeJS have not been released.
Perhaps what you can do in the meantime is call the API endpoint directly, for example with a cURL command like below:
curl -X POST "https://<API_KEY>:<API_SECRET>@api.cloudinary.com/v1_1/<CLOUD_NAME>/folders/<NEW_FOLDER_NAME>"
0
Post is closed for comments.
Comments
5 comments