Problem retrieving resource details when the resource is in a folder

SMW
SMW Member Posts: 4
edited June 2023 in Developer APIs

I'm using the node sdk, to hit the Admin API

const result = await cloudinary.api.resource(public_id,{resource_type:'video'})

Which works fine when the resource is in the root, but not when it is in a folder.

cloudinary.search returns a public_id of "path/to/my-asset-123456"

cloudinary.api.resource returns an error whether the path is included in the public id or not.

How can I get the resource details for items in folders?

Tagged:

Answers

  • millie_axelrod
    millie_axelrod Member, Cloudinary Staff Posts: 8

    Hi there,

    Thanks for reaching out.

    To retrieve the resource details for an item which is located within a folder, you would need to include the entire folder path as it is part of the public id.

    Here is an example using the Node SDK:

    var res=await cloudinary.api.resource("samples/cld-sample-video",{"resource_type":'video'}).then(result=>console.log(result));
    

    In order to further investigate the error you are encountering, could you please open a support request with your cloud name, the public id and the error message that you are receiving?

    Thanks,

    Millie