Does anyone know why expand=all was removed in v2 ...
# help-with-umbraco
k
In the previous version setting expand=all as a querystring would expand all nested properties, this is no longer the case. I feel that it was quite useful for static site generation.
r
I'm wondering about the same thing.
j
I believe the syntax has changed so you would do
?expand=properties[$all]
https://docs.umbraco.com/umbraco-cms/reference/content-delivery-api/property-expansion-and-limiting
k
So right now my workaround is to nest the expand all for example expand=$all[$all[$all]] will work for three levels. But it's really not ideal
j
Yes, you have to decide how many levels you want. It is really not performant to expand an infinite amount of levels. There is a discussion about auto-expanding media elements, since people always seem to need those. Blocks are already auto-expanding. Consider querying extra for elements on a need-basis. You should get the GUIDs out for elements that are not expanded, right?
k
I agree that it's not performant, and yeah I do get the GUIDs so I can indeed do multiple queries. But I'm using the API to statically generate a website and an app. So performance is not super critical for me as the only load on the Umbraco site is when the site is generated. This also means that I will always need the extra elements on every request. I'm mostly curious why they removed the feature to begin with. Maybe because it's a performance pitfall as you said. And I'm sad that the query couldn't be a little easier to read the nested $all is a bit messy. I might try to extend this so that I can write how many levels I wanna auto expand as a separate query string
j
As far as I know, the V1 query for
expand=all
also gave you only the first level, and you could not "add" more levels to the query, which is now possible with the (albeit messy) $all[$all] syntax
k
expand all seems to expand all the levels in my 3 level example
5 Views