« first day (2250 days earlier)      last day (1048 days later) » 

11:01 AM
Can someone help me convert this API call into something that could be handle from R?
https://developers.notion.com/reference/get-databases
It's not clear to me how to add authentication to begin with.
My first thought was to get the cURL example working.
curl -X POST api.notion.com/v1/pages \
  -H "Authorization: Bearer $NOTION_KEY" \
  -H "Content-Type: application/json" \
  -H "Notion-Version: 2021-05-13" \
  --data "{
    \"parent\": { \"database_id\": \"$NOTION_DATABASE_ID\" },
    \"properties\": {
      \"title\": {
        \"title\": [
          {
            \"text\": {
              \"content\": \"Yurts in Big Sur, California\"
            }
          }
        ]
      }
    }
  }"
Not sure how to append the credentials through a header yet.
ask <- GET(url = "https://api.notion.com/v1/databases",
           add_headers(NOTION_KEY))
stop_for_status(ask)
 
11:37 AM
This makes GET return something, but it's not a json, but rather a notion.so website.
ask <- GET(url = "https://api.notion.com",
           accept_json(),
           add_headers(Authorization = NOTION_KEY, Version = "v1"),
           query = list(databases = NOTION_DATABASE_ID)
)
 
12:18 PM
Looks like someone has had a similar idea in the past. stackoverflow.com/questions/67679829/…
 

« first day (2250 days earlier)      last day (1048 days later) »