Search by public_id/ids without specifying resource type?
Hi. We are using Cloudinary Node.js API. Is there a way to get media details by searching the public_id and/or public_ids without providing the resource type?
-
Hi John,
You can use the search API to search by public_id. In the expression field use the `public_id` parameter.
For example:
cloudinary.v2.search
.expression('public_id:my_folder/test`)
.sort_by('public_id','desc')
.max_results(30)
.execute().then(result=>console.log(result));If you would like to search by a few public_ids add the OR operator like this:
`public_id:test OR public_id:duplicate/mine`
In addition, you can search just by any word and get results of all assets containing this word. For example:
cloudinary.v2.search
.expression('dog')
.sort_by('public_id','desc')
.max_results(30)
.execute().then(result=>console.log(result));Read here for more info: https://cloudinary.com/documentation/search_api#expression_fields
0
Post is closed for comments.
Comments
1 comment