zadam / trilium

Build your personal knowledge base with Trilium Notes
GNU Affero General Public License v3.0
27.2k stars 1.9k forks source link

(Bug report) ETAPI POST /branches is broken #2978

Closed st3iny closed 2 years ago

st3iny commented 2 years ago

Trilium Version

0.53.2

What operating system are you using?

Other Linux

What is your setup?

Server access only

Operating System Version

Docker Image

Description

I'm not able to create branches via the ETAPI. Posting a body with and without parentNodeId fails. The branch I'm trying to create does not exist yet.

Posting with parentNodeId

curl --request POST \
  --url https://[REDACTED]/etapi/branches \
  --header 'Authorization: [REDACTED]' \
  --header 'Content-Type: application/json' \
  --data '{
    "noteId": "YH9DW9VNzeDt",
    "parentNodeId": "w7XEQyNMjzJi"
}'
{
    "status": 400,
    "code": "PROPERTY_NOT_ALLOWED",
    "message": "Property 'parentNodeId' is not allowed for PATCH."
}

Posting without parentNodeId

curl --request POST \
  --url https://[REDACTED]/etapi/branches \
  --header 'Authorization: [REDACTED]' \
  --header 'Content-Type: application/json' \
  --data '{
    "noteId": "YH9DW9VNzeDt"
}'
{
    "status": 500,
    "code": "GENERIC",
    "message": "NOT NULL constraint failed: branches.parentNoteId"
}
zadam commented 2 years ago

Hi, you have a typo in the property name, it's parentNoteId, not parentNodeId. Easy mistake to make ...

st3iny commented 2 years ago

Wow, thanks. Sometimes a second pair of eyes really helps ...