User update API doesn't work #4006

Closed
opened 2026-02-05 08:02:39 +03:00 by OVERLORD · 0 comments
Owner

Originally created by @reachlin on GitHub (Aug 25, 2023).

Describe the Bug

Trying to update a user from user PUT api, but nothing changed. The returned user is the same and no errors.

user_id = 6
url = f"{url_host}/api/users/{user_id}"
data = '''{
    "name": "test name",
    "email": "aaa@test.com",
    "roles": [5]
}'''
response = requests.put(url, headers=headers, data=data)
if response.status_code == 200:
    print(response.json())
else:
    print(f"Error: {response.status_code}")

output:
{'id': 6, 'name': 'test', 'email': 'test@test.com', 'created_at': '2023-08-25T01:54:29.000000Z', 'updated_at': '2023-08-25T01:54:29.000000Z', 'external_auth_id': '', 'slug': 'test', 'profile_url': 'http://localhost/user/test', 'edit_url': 'http://localhost/settings/users/6', 'avatar_url': 'http://localhost/user_avatar.png', 'roles': [{'id': 4, 'display_name': 'Public'}]}

Steps to Reproduce

user_id = 6
url = f"{url_host}/api/users/{user_id}"
data = '''{
    "name": "test name",
    "email": "aaa@test.com",
    "roles": [5]
}'''
response = requests.put(url, headers=headers, data=data)
if response.status_code == 200:
    print(response.json())
else:
    print(f"Error: {response.status_code}")

Expected Behaviour

name, email, and role should be updated

Screenshots or Additional Context

No response

Browser Details

No response

Exact BookStack Version

v23.06.2

PHP Version

No response

Hosting Environment

image: lscr.io/linuxserver/bookstack

Originally created by @reachlin on GitHub (Aug 25, 2023). ### Describe the Bug Trying to update a user from user PUT api, but nothing changed. The returned user is the same and no errors. ``` user_id = 6 url = f"{url_host}/api/users/{user_id}" data = '''{ "name": "test name", "email": "aaa@test.com", "roles": [5] }''' response = requests.put(url, headers=headers, data=data) if response.status_code == 200: print(response.json()) else: print(f"Error: {response.status_code}") ``` output: {'id': 6, 'name': 'test', 'email': 'test@test.com', 'created_at': '2023-08-25T01:54:29.000000Z', 'updated_at': '2023-08-25T01:54:29.000000Z', 'external_auth_id': '', 'slug': 'test', 'profile_url': 'http://localhost/user/test', 'edit_url': 'http://localhost/settings/users/6', 'avatar_url': 'http://localhost/user_avatar.png', 'roles': [{'id': 4, 'display_name': 'Public'}]} ​ ### Steps to Reproduce ``` user_id = 6 url = f"{url_host}/api/users/{user_id}" data = '''{ "name": "test name", "email": "aaa@test.com", "roles": [5] }''' response = requests.put(url, headers=headers, data=data) if response.status_code == 200: print(response.json()) else: print(f"Error: {response.status_code}") ``` ### Expected Behaviour name, email, and role should be updated ### Screenshots or Additional Context _No response_ ### Browser Details _No response_ ### Exact BookStack Version v23.06.2 ### PHP Version _No response_ ### Hosting Environment image: lscr.io/linuxserver/bookstack
OVERLORD added the 🐛 Bug label 2026-02-05 08:02:39 +03:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/BookStack#4006