Good afternoon .
I want to add some 100 users into a group in Stash. I am an admin and so I am able to create group and add users. Do I have to add the users individually, or can I add them together, instead of seperately in the group via some plug-in??
Regards,
-Jewel
Hi Jewel,
To retrieve a list of users from your instance (which is documented here: https://developer.atlassian.com/static/rest/stash/3.3.0/stash-rest.html#idp687024) and use as an input for a parser to obtain the list of users you want to assign to a certain group, please use the curl call below:
$ curl --user admin:admin http://localhost:7990/rest/api/1.0/admin/users
Output:
{"size":3,"limit":25,"isLastPage":true,"values":[{"name":"admin","emailAddress":"user@user.com","id":1,"displayName":"Thiago Bomfim","active":true,"slug":"admin","type":"NORMAL","directoryName":"Stash Internal Directory","mutableDetails":true,"mutableGroups":true,"link":{"url":"/users/admin","rel":"self"},"links":{"self":[{"href":"http://localhost:7990/users/admin"}]}},{"name":"testuser1","emailAddress":"testuser1@user.com","id":2,"displayName":"Test User 1","active":true,"slug":"testuser1","type":"NORMAL","directoryName":"Stash Internal Directory","mutableDetails":true,"mutableGroups":true,"link":{"url":"/users/testuser1","rel":"self"},"links":{"self":[{"href":"http://localhost:7990/users/testuser1"}]}},{"name":"testuser2","emailAddress":"test@user2.com","id":51,"displayName":"Test User 2","active":true,"slug":"testuser2","type":"NORMAL","directoryName":"Stash Internal Directory","mutableDetails":true,"mutableGroups":true,"link":{"url":"/users/testuser2","rel":"self"},"links":{"self":[{"href":"http://localhost:7990/users/testuser2"}]}}],"start":0}
The following curl call works for me and assign the users "testuser1" and "testuser2" to a group called "newtestgroup". This is documented here: https://developer.atlassian.com/static/rest/stash/3.3.0/stash-rest.html#idp759792
$ curl -H "Content-Type:application/json" -H "Accept:application/json" --user admin:admin -X POST -d '{"group": "newtestgroup","users": ["testuser1","testuser2"]}' http://localhost:7990/rest/api/1.0/admin/groups/add-users
I hope that is helpful.
Best regards,
Thiago Bomfim
Atlassian Support - DevTools
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This works perfectly, is it possible to add users using email id or displayname instead of Users ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You can do this via the REST API. (You need http://example.com/rest/api/1.0/admin/groups/add-users [POST] )
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I think there this is mislinked. This should be the right rest point to use https://developer.atlassian.com/static/rest/stash/3.3.0/stash-rest.html#idp687024
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It seems that the numbers after the # change for each session(?) If I navigate to the right place, copy the link, close the tab, paste the link, it takes me to a different place than previously. Anyway. Updated the answer to be more helpful.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Balazs/Deric, Thank you for the update. I am checking it out. Will let you know of the outcome.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
How does the REST API work to add users when a system is connected to LDAP ? If a stash instance is LDAP enabled it should authenticate the users against LDAP, and find user attributes such as email in LDAP. Is it allowed to add users via REST API without specifying values for email and password ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.