typeoneerror
(Benjamin Borowski)
September 28, 2018, 6:17am
1
The ruby API shows an option to assign owner_usernames
on create_group
and update_group
. The create_group
seems to work (and the owner is there after the group is created) but it appears that owner_usernames
are only assignable on create
on the REST side of things . So we can’t promote a user to an existing group owner without the UI (at least with the Ruby API).
Is this by design or is this worth a PR? Am I correct in assuming the Ruby side of things would need matching methods for groups#add_owners
and groups#remove_owner
?
1 Like
zogstrip
(Régis Hanol)
September 28, 2018, 6:23am
2
The UI is using the API. Have you tried this?
Discourse is backed by a complete JSON api. Anything you can do on the site you can also do using the JSON api.
Many of the endpoints are properly documented in the discourse_api gem, however some endpoints lack documentation.
To determine how to do something with the JSON API here are some steps you can follow.
Example: recategorize a topic.
Go to a topic and start editing a category:
[image]
Open Chrome dev tools, switch to the Network tab, select XHR filter:
[image]
Perform the op…
3 Likes
typeoneerror
(Benjamin Borowski)
September 28, 2018, 6:25am
3
Thanks, Régis. I’m not seeing anything for ownership in https://github.com/discourse/discourse_api/blob/master/lib/discourse_api/api/groups.rb . I was just checking to make sure I wasn’t missing something. I can certainly just do a put request to the /admin/groups/:group_name/owners
API endpoint directly without a method in the Ruby API.
1 Like
sam
(Sam Saffron)
November 2, 2018, 5:56am
4
The API gem may have some gaps, if you find any feel free to plug them in with PRs.
1 Like
blake
(Blake Erickson)
August 10, 2021, 2:10pm
6
Methods for adding and removing group owners now exist in the discourse_api gem.
discourse:main
← discourse:group-owners
opened 01:39PM - 10 Aug 21 UTC
Added two new methods for adding or removing group owners and updated some outda… ted params for the update user method.
@client.group_add_owners(41, { usernames: "48ce9df193c627574202" } )
@client.group_remove_owners(41, { usernames: "48ce9df193c627574202" } )
2 Likes