When using the API to add members and owners to a group, it looks like the required data format is different. This may be intentional but I’d like to know why (it’s breaking pydiscourse, the best library I can find for interacting with the Discourse API in Python).
Adding a member to a group:
curl -X PUT "https://{mydomain}/admin/groups/{group_id}/members.json" \
-d 'usernames={my-username}' \
-H "Api-Key: {my-api-key}" \
-H "Api-Username: {my-api-username}"
Adding an owner to a group:
curl -X PUT "https://{mydomain}/admin/groups/{group_id}/owners.json" \
-d 'group[usernames]={my-username}' \
-H "Api-Key: {my-api-key}" \
-H "Api-Username: {my-api-username}"
I’m curious why the key for the username param in the owners endpoint needs to be written as group[usernames]
instead of just usernames
?