- 
  Notifications
 You must be signed in to change notification settings 
- Fork 56
How to create a synced block #464
 
 Unanswered
 
 
 
 
 taco-indenbosch
 
 
 
 asked this question in
 Q&A
 
 -
Does anyone know how to successfully create an (initial) synced block?
I have tried the following:
 string pageId="...";
 IList<ISyncedBlockChildrenRequest> blocks=...
 var content = new SyncedBlockBlockRequest()
 {
 SyncedBlock = new()
 {
 Children = blocks,
 SyncedFrom = null
 }
 };
 var result=await notionClient.Blocks.AppendChildrenAsync(new BlockAppendChildrenRequest(){BlockId = pageId, Children = [content] });
The SyncedFrom=null should not be necessary as it is the default value.
This fails with the following exception:
Notion.Client.NotionApiException: body failed validation: body.children[0].synced_block.synced_from should be defined, instead was undefined.
I guess the problem is that the null value for SyncedFrom is serialized as a missing property when sent to the Notion API, thereby being undefined rather than a Javascript null, but I don't know how to send an actual null. Or is there something else I am doing wrong?
Beta Was this translation helpful? Give feedback.
All reactions
Replies: 0 comments
 
 Sign up for free
 to join this conversation on GitHub.
 Already have an account?
 Sign in to comment