Notion.so API for .NET users..
Notion logo credit: Notion Media Kit
Okay Notion Client aims to provide easy and okay access to the Notion Developer Portal
Before use, read up on Notion's API atActions Supported
Authentication
- Provides basic authentication with RestSharp and your notion access token.
Read
- List Databases for given access token
- List pages for selected database
- Read database properties
Write
- NOT SUPPORTED (YET)
Usage
The library can be used as follows:
using System;
using System.Linq;
using OkayNotionClient;
namespace NotionSample
{
class Program
{
static void Main(string[] args)
{
NotionClient client = new NotionClient(yourAccessTokenHere);
var firstDatabase = client.ListDatabases().First();
Console.WriteLine($"fetching pages for {firstDatabase.Title.First().PlainText}");
var pages = client.ListPagesForDatabase(firstDatabase);
foreach (var page in pages)
{
Console.WriteLine($"page id: {page.Id} was last edited at {page.LastEditedTime}");
}
Console.ReadLine();
}
}
}
resulting in:
Built With
The OkayNotionClient
project relies on a few community-published NuGet packages as listed below :
- Newtonsoft - handles serializing and deserializing to JSON
- RestSharp - enables easier interaction with REST API endpoints
Special Thanks
Special thanks to Radu for sharing DynaWeb. This package really helped me understand REST calls.