Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to copy a page and have it save #519

Open
ParthGandhi opened this issue May 5, 2022 · 0 comments
Open

Unable to copy a page and have it save #519

ParthGandhi opened this issue May 5, 2022 · 0 comments

Comments

@ParthGandhi
Copy link

ParthGandhi commented May 5, 2022

Context

I have a nested database with some rows. I want to script creating a new row by coping an existing row OR by using a template.

Describe the bug
Unable to copy a page and have it save

To Reproduce
I first tried to do this outside of a database, just for a regular page but couldn't get it to work.

import { NotionCore } from "@nishans/core";

const nishan = new NotionCore.Api.Nishan({
  token: "XXXXX",
  logger: true,
});

(async () => {
  const pageId = "some-UUID";
  const pages = await nishan.getPagesById([pageId]);
  const page = pages.page.get(pageId);
  const res = await page?.duplicate(1);
  console.log(res);
})();

It outputs some JSON, but I can't find the relevant page on notion or where its copied to. Any ideas on how to do this correctly?

2 additional questions:

  1. Is there a way to create a new row in a collection/database using a template? Or copy a row in a database into a new row?
  2. Is there a full working example I can use as a reference?
  3. Could you update the discord invite? The current link everywhere is invalid.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant