python-keycloak
python-keycloak copied to clipboard
create_group returns an empty response
Keycloak returns an empty HTTP body on the POST /{realm}/groups call, but includes the new group ID in the Location header. create_group should behave similar to create_user, which reads the new ID from the Location header and returns it.
My current workaround is to make an additional call to get_group_by_path to get the new group ID.
I can't make create_group work at all!
-
create_group("new-group-name") give me this error: File "/home/paulm/.local/lib/python3.9/site-packages/keycloak/keycloak_admin.py", line 702, in create_group return raise_error_from_response(data_raw, KeycloakGetError, expected_codes=[201], skip_exists=skip_exists) File "/home/paulm/.local/lib/python3.9/site-packages/keycloak/exceptions.py", line 106, in raise_error_from_response raise error(error_message=message,
-
create_group(name="new-group-name") give me this error: TypeError: create_group() got an unexpected keyword argument 'name'
@speculatrix create_group is expecting a dictionary for payload. Try create_group({"name": "new-group-name"}).
It's worth noting that the response when creating a subgroup does include new group information:
>>> kc.create_group({"name":"A"}, parent="ab...")
{'id': 'cd...',
'name': 'A',
'path': '/hello/A',
'attributes': {},
'realmRoles': [],
'clientRoles': {},
'subGroups': []}
I second that a similar response should be given when creating a group without a parent.