API updating book_id on chapter not working #3823

Closed
opened 2026-02-05 07:35:08 +03:00 by OVERLORD · 2 comments
Owner

Originally created by @awmol on GitHub (May 26, 2023).

Describe the Bug

Updating book_id on a chapter through API does not change the book_id.

No issue updating other data on a chapter through the api like name, description and tags.
No issue creating a chapter with a specifik book_id through the API.

Steps to Reproduce

Trying to change chapter book_id from 4 to 5, tried several different body syntaxes:

curl --request PUT --url https://bookstack.domain/api/chapters/1232 --header 'Authorization: Token xxxxx' -H 'Content-Type: application/json' -d '{"book_id":"5"}'
curl --request PUT --url https://bookstack.domain/api/chapters/1232 --header 'Authorization: Token xxxxx' -H 'Content-Type: application/json' -d '{book_id:5}'
curl --request PUT --url https://bookstack.domain/api/chapters/1232 --header 'Authorization: Token xxxxx' -H 'Content-Type: application/json' -d '{'book_id':'5'}'
curl --request PUT --url https://bookstack.domain/api/chapters/1232 --header 'Authorization: Token xxxxx' -H 'Content-Type: application/json' -d '{'book_id':5}'
curl --request PUT --url https://bookstack.domain/api/chapters/1232 --header 'Authorization: Token xxxxx' -H 'Content-Type: application/json' -d '{"book_id":5}'

Expected Behaviour

expected a result like:

{"id":1232,"book_id":5,"slug":"test1","name":"test1","description":"test move chapter","priority":277,"created_at":"2023-05-25T13:39:51.000000Z","updated_at":"2023-05-26T08:36:05.000000Z","created_by":6,"updated_by":6,"owned_by":6,"book_slug":"testbook2"}

But get a result like:

{"id":1232,"book_id":4,"slug":"test1","name":"test1","description":"test move chapter","priority":277,"created_at":"2023-05-25T13:39:51.000000Z","updated_at":"2023-05-26T08:36:05.000000Z","created_by":6,"updated_by":6,"owned_by":6,"book_slug":"testbook1"}

Screenshots or Additional Context

No response

Browser Details

curl

Exact BookStack Version

v23.05.1

PHP Version

No response

Hosting Environment

Debian 11, PHP 8.2.6, Nginx +php-fpm

Originally created by @awmol on GitHub (May 26, 2023). ### Describe the Bug Updating book_id on a chapter through API does not change the book_id. No issue updating other data on a chapter through the api like name, description and tags. No issue creating a chapter with a specifik book_id through the API. ### Steps to Reproduce Trying to change chapter book_id from 4 to 5, tried several different body syntaxes: curl --request PUT --url https://bookstack.domain/api/chapters/1232 --header 'Authorization: Token xxxxx' -H 'Content-Type: application/json' -d '{"book_id":"5"}' curl --request PUT --url https://bookstack.domain/api/chapters/1232 --header 'Authorization: Token xxxxx' -H 'Content-Type: application/json' -d '{book_id:5}' curl --request PUT --url https://bookstack.domain/api/chapters/1232 --header 'Authorization: Token xxxxx' -H 'Content-Type: application/json' -d '{'book_id':'5'}' curl --request PUT --url https://bookstack.domain/api/chapters/1232 --header 'Authorization: Token xxxxx' -H 'Content-Type: application/json' -d '{'book_id':5}' curl --request PUT --url https://bookstack.domain/api/chapters/1232 --header 'Authorization: Token xxxxx' -H 'Content-Type: application/json' -d '{"book_id":5}' ### Expected Behaviour expected a result like: {"id":1232,"book_id":5,"slug":"test1","name":"test1","description":"test move chapter","priority":277,"created_at":"2023-05-25T13:39:51.000000Z","updated_at":"2023-05-26T08:36:05.000000Z","created_by":6,"updated_by":6,"owned_by":6,"book_slug":"testbook2"} But get a result like: {"id":1232,"book_id":4,"slug":"test1","name":"test1","description":"test move chapter","priority":277,"created_at":"2023-05-25T13:39:51.000000Z","updated_at":"2023-05-26T08:36:05.000000Z","created_by":6,"updated_by":6,"owned_by":6,"book_slug":"testbook1"} ### Screenshots or Additional Context _No response_ ### Browser Details curl ### Exact BookStack Version v23.05.1 ### PHP Version _No response_ ### Hosting Environment Debian 11, PHP 8.2.6, Nginx +php-fpm
OVERLORD added the 🐛 Bug🏭 Back-End🔩 API Request labels 2026-02-05 07:35:08 +03:00
Author
Owner

@ssddanbrown commented on GitHub (May 26, 2023):

Can confirm, looks like for chapters we don't specifically handle moving via the provided book_id like we do for pages, but we probably should do to align functionality and since the property is shown in the API docs.

Will assign to be addressed in the next feature release. Thanks for reporting @awmol.

@ssddanbrown commented on GitHub (May 26, 2023): Can confirm, looks like for chapters we don't specifically handle moving via the provided `book_id` like we do for pages, but we probably should do to align functionality and since the property is shown in the API docs. Will assign to be addressed in the next feature release. Thanks for reporting @awmol.
Author
Owner

@ssddanbrown commented on GitHub (May 30, 2023):

This has now been added within commit 0323ebccd3, and will therefore be part of the next feature release.

@ssddanbrown commented on GitHub (May 30, 2023): This has now been added within commit 0323ebccd3747cc757819e265ccad87889ec0acf, and will therefore be part of the next feature release.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/BookStack#3823