Issue Retrieving Note Content via Joplin API

Operating system

Windows

Joplin version

2.13.12

Desktop version info

Joplin 2.13.12 (prod, win32)

客户端 ID: e3befba3447847bbb3aaba26c3a02907
同步版本:3
配置文件版本:44
支持的密钥链:是

修订:e027cdc

Admonition markdown extension: 1.1.0
Advanced Tagging Rules: 1.2.0
Calendar: 1.0.0-rc2
Favorites: 1.3.2
GitHub Theme: 0.3.0
Joplin DDDot: 0.2.0
Markdown table calculations: 1.0.5
Markdown Table: Colorize: 1.1.4
Markmap: 1.6.0
Math Mode: 0.6.2
Note Tabs: 1.4.0
OCR: 0.3.2
Paste Special: 1.1.2
Quick Goto: 1.2.0
Search & Replace: 2.2.0
Text Colorize: 1.2.5

Sync target

Joplin Server

Editor

Markdown Editor

What issue do you have?

ello,

I've been experiencing an issue with retrieving the full content of notes using Joplin's API. While I can successfully access the basic information of a note (such as id, parent_id, title, and type_), I'm unable to retrieve the body content of the note, which should contain the main text in Markdown or HTML format.

Here's the function I'm using:

python
Copy code
def get_note_content(note_id, token):
try:
response = requests.get(
f"{JOPLIN_URL}/notes/{note_id}", params={"token": token}
)
response.raise_for_status()
note_content = response.json()
print(note_content) # This prints basic note info, but no 'body' content
return note_content.get("body", None)
except requests.RequestException as e:
print(f"Request error: {e}")
return None
The Joplin server is confirmed to be deployed correctly.
The note I'm querying is not empty and contains content.
The API version is up-to-date, and I've cross-checked the implementation with the latest Joplin API documentation.
Network and server connections are stable.
Despite these checks, the body content of the note remains inaccessible. I would appreciate any insights or solutions to this issue.

Thank you!

You have to define the fields you want to have in your query.

response = requests.get(
f"{JOPLIN_URL}/notes/{note_id}", params={"token": token, "fields": "id,title,body"}
)

https://joplinapp.org/help/api/references/rest_api#properties

1 Like

Thank you very much for your assistance. The suggestion to specify the fields in the query resolved the issue. I might have overlooked this detail in the API documentation, so your guidance was invaluable. The issue is now fixed, and I'm able to retrieve the note content as expected. I appreciate your help and the quick response!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.