Skip to main content

notion.notion.retrievedatabase

Home > @runlightyear/notion > Notion > retrieveDatabase

Notion.retrieveDatabase() method

Retrieve a database

Signature:
retrieveDatabase(props: RetrieveDatabaseProps): Promise<RetrieveDatabaseResponse>;

Parameters

ParameterTypeDescription
propsRetrieveDatabaseProps
Returns:

Promise<RetrieveDatabaseResponse>

Example

Retrieve a database

import { defineAction } from "@runlightyear/lightyear";
import { Notion } from "@runlightyear/notion";

defineAction({
name: "retrieveDatabase",
title: "Retrieve Database",
apps: ["notion"],
variables: ["databaseId"],
run: async ({ auths, variables }) => {
const notion = new Notion({
auth: auths.notion,
});
const response = await notion.retrieveDatabase({
databaseId: variables.databaseId!,
});
console.log("Result: ", response.data);
},
});