'Get page's blocks in EPiServer Content delivery API

I have a page in Episerver / Optimizely, with a page that has some blocks, but I want to access the blocks through https://localhost:5000/api/episerver/v3.0/content/57 (whith episerver content delivery api), but the blocks won't follow. Is it possible to return the blocks with the page?



Solution 1:[1]

This is an ODATA api, you'll need to tell it to expand the properties you want to see

To expand everything

https://localhost:5000/api/episerver/v3.0/content/57?expand=*

To expand a certain property

https://localhost:5000/api/episerver/v3.0/content/57?expand=propertyToExpand

Comma separate properties to expand if multiple

https://localhost:5000/api/episerver/v3.0/content/57?expand=propertyToExpand,otherPropertyToExpand

Optimize your query by using select (you should)

https://localhost:5000/api/episerver/v3.0/content/57?expand=propertyToExpand,otherPropertyToExpand&select=propertyToExpand,otherPropertyToExpand

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Eric Herlitz