Content blocks and Record blocks can both be converted from their raw form into advanced or simple.
This is a built in feature for most of the methods you’ll use (i.e.: query, getPageContent, getRecord). However, you might want to convert the blocks yourself to a different format based on a specific use case
Process block by block
When rendering the data for a given page, you might want to treat certain blocks differently. The first query will by default return the raw version of it1, once you have the raw version you can process it to convert it to the simple or advanced layers of the API, and treat each block differently
Example 1: Render social embeds in your application with a custom library.
Example 2: Render links to other pages from notion by retrieving the data for the page, and mapping it out in your application.
-
This is particularly useful because the heaviest query is pulling the original data as it is structured by notion, which sends much more information over the wire than what you may actually need in your application. If this data doesn’t vary frequently, chances are you want to cache it and re-use it across your application. ↩
Last updated: