Hi there! I am building an application that fetches multiple collections from Cockpit on startup. For now, I have to make one request per collection. I am wondering is it possible to send just one request to cockpit and receive every collection with content from them? I know we can get list of collections, but they do not contain content.
Thanks in advance!
I know we can get list of collections, but they do not contain content.
Yea, collection list will only return its names without content.
You’ll have 3 options to achieve this.
1 - Use CockpitQL addons
You can get CockpitQL addon here
If you’re not quite familiar with GraphQL, you can use the below options.
2 - Use collectionLink
https://zeraton.gitlab.io/cockpit-docs/guide/basics/field-types.html#collection-link
You can link collections with collectionLink
field however, I think, fetching many collections in a single request still a bad practice and it’d affect the performance of your API.
3 - Write an addon to grab all collections with a single endpoint.
It’s coding stuffs and you may have to take a look these scripts