brd6/notion-sdk-php

Creating an empty list item or todo

wsabol opened this issue · 1 comments

See the title. I want to create come empty list items and todos, like you can make in the app itself and in many templates. but api is rejecting it

How do I... ?

This is the response I'm getting from the API
Client error: `POST https://api.notion.com/v1/pages/` resulted in a `400 Bad Request` response: {"object":"error","status":400,"code":"validation_error","message":"body failed validation. Fix one:\nbody.children[7].b (truncated...)

Example code

Its happens when I add a bulleted list items like this

        $block = new BulletedListItemBlock();
        $blockProperty = new BulletedListItemProperty();
        $blockProperty->setRichText([Text::fromContent("")]);
        $block->setBulletedListItem($blockProperty);
        ...
brd6 commented

Hi @wsabol, thank you for reporting 🙂
After testing, the Notion API rejects the request because of the empty string.
I made a fix to allow empty strings !