Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

API token is invalid only when I try to update a page properties. #239

Answered by ramnes
kwokrico asked this question in Q&A
Discussion options

I am facing a strange problem here. I have no problem using notion sdk to create, query and delete pages, but when it comes to updating a page properties, it always results in a 401 Error: API token is invalid. I'm really confused whether I did something wrong with my codes, token setup, wrong formatting of the properties to be updated or it's just a bug.

The images below are my codes and the logs. Much appreciated if anyone can help me solve this problem here. Thanks in advance.

image

image
image
image

You must be logged in to vote

I think you have two problems:

  • Your update parameters are invalid (there's at least properties={"properties": ...}} that seems wrong at first sight) – please refer to the Notion API reference;
  • HTTPX seems out of date, because httpx.HTTPStatusError should exist since version 0.14.0 (August 7th, 2020).

What version do you use?

Replies: 1 comment 1 reply

Comment options

I think you have two problems:

  • Your update parameters are invalid (there's at least properties={"properties": ...}} that seems wrong at first sight) – please refer to the Notion API reference;
  • HTTPX seems out of date, because httpx.HTTPStatusError should exist since version 0.14.0 (August 7th, 2020).

What version do you use?

You must be logged in to vote
1 reply
Comment options

I have solved the problem, after looking into your answer. Thanks. There are a few helpful links below in case anyone facing a similar problem in the future.

For 1, I found the Page properties and Property values in the the Notion API reference.
Noted that in page properties, there is a properties={"properties": ...}} in its Example properties body param for a POST or PATCH page in the page properties page (but it is not needed in my final code) (Maybe I misunderstood something there)
image

For 2, updating the library solves my problem.

Anyway. Thank you for the help.

Answer selected by kwokrico
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants

AltStyle によって変換されたページ (->オリジナル) /