The JSON returned by the CMS API does not include the full definition of a multi-reference object. It only returns the ID. This then requires separate API calls for each sub item. I would also expect this work on multiple levels i.e. multiref items which link to multiref items.
My data structure: Books > Chapters > Notes. I would expect to query the Books Collection and have all nested objects returned in a single JSON response.
As emailed @cyberdave
So the API does have (currently un-documented) support for single level item reference expansion, but it currently will not do nested expansions and multiple API calls will be necessary for that.
I’ve created an issue to update the actual docs to include this info, but if you want to play around with it in the meantime, the fetch items endpoint supports an additional parameter
expand which expects an array of the fields you want expanded.
So with the example here: https://developers.webflow.com/?shell#get-all-items-for-a-collection, the updated request to expand a field
books would be:
Is that useful for your use case?
Let me know if you have any questions!
This is super helpful. It massively reduces my number of API calls. And it
reduces the amount of code needed to parse it. It would be great if nested
expansions were possible as I could throw away even more code!