Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

How to create a synced block #464

Unanswered
taco-indenbosch asked this question in Q&A
Discussion options

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?

You must be logged in to vote

Replies: 0 comments

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant

AltStyle によって変換されたページ (->オリジナル) /