I have a folder, let’s say ‘gallery’
I can currently get all assets with the https://getcockpit.com/documentation/api/cockpit
If I want to filter assets only within the
gallery folder, how will I go about that?
Is it possible to use a custom query passed along in the
body of the request to do that?
Currently what I’m thinking of a workaround is simply getting all the assets, then filtering locally in the browser, based on a tag, which I’ll have to set on all the images within the gallery folder.
Yes, you need to pass the
folder id in the filter like:
Issue is that you may need to do a query first to get the folder ids and if not wrong the core API doesn’t provide that, but you can add it like:
Create a new file in
return $this->storage->findOne('cockpit/assets_folders', ['name' => $this->param('name')]);
So if you invoke the endpoint
/api/folder?token=xxxx&name=FolderX you’ll receive the folder data: