notion-dotnet / notion-sdk-net

A Notion SDK for .Net
MIT License
186 stars 46 forks source link

Notion.Client.NotionApiException: Could not find database with ID: 4f68615b-2dd8-4d3d-af71-..... #221

Closed chuongmep closed 2 years ago

chuongmep commented 2 years ago

Describe the bug A clear and concise description of what the bug is. I used the concept api to work, reading the page is normal, but with the database, I can't browse, am I missing something?

Screenshots ảnh Code Sample

static void Main(string[] args)
        {
            WebNotion wevNotion = new WebNotion();
            //wevNotion.GetTest();
            wevNotion.GetDataBase();
            Console.ReadKey();
        }

public class WebNotion {

 public WebNotion()
        {
            Client = NotionClientFactory.Create(new ClientOptions()
            {
                AuthToken = Token,
            });
        }
public void GetDataBase()
        {
            try
            {
                Task<Database> databases = Client.Databases.RetrieveAsync("ba876fca0bb446b6a27f311928272e62");
                string resultUrl = databases.Result.Id;
                Console.WriteLine(resultUrl);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.ToString());
                throw;
            }
        }
}
0xtaichim commented 2 years ago

you need to click Share and select Invite bot into your page

For example:

chuongmep commented 2 years ago

Yes, i have

KoditkarVedant commented 2 years ago

I can't really say what must be wrong. One of the reason is mentioned by @heytaichi. If you done that already check if you can find it using Search API. It could be that you may be using invalid ID or ID of a different object type (may be page or something).

chuongmep commented 2 years ago

Hi @KoditkarVedant, I have read document, may be error from documents, https://developers.notion.com/docs/getting-started#share-a-database-with-your-integration,example database ID in document guide is "https://www.notion.so/myworkspace/a8aec43384f447ed84390e8e42c2e089?v=... |--------- Database ID --------|" but a8aec43384f447ed84390e8e42c2e089 before character ?v is database ID, it took me 3 days to figure this stupid thing out. After edit and input again, it's working perfect.