Create user with group using rest API

TeamCity Version: 2018.2.3

I am really struggling to work out how to create a user with an already created group (via the REST API). The documentation isn't very clear. I found a post about the topic but when I tried it it didn;t work for me (https://teamcity-support.jetbrains.com/hc/en-us/community/posts/360000487520-TeamCity-REST-API-Add-user-to-group-)

JSON Data:

{
   "username": "Simon",
   "password": "Smith",
   "groups": "GROUP_KEY"
}

I have replaced the values with generic data. Can someone show me how to contruct my JSON for creating a new user with a group that already exists (in my case I am creating the group first via the same script using the REST API).

0
2 comments
Avatar
Permanently deleted user

Sorted, ignore this

0
Avatar
Permanently deleted user

Solution:

The JSON structure should be:

{
    "username": "Simon",
    "password": "Smith",
       "groups": {
          "group": [
          {
             "key": "groupKey",
             "name": "groupName"
          }
       ]
    }
}

0

Please sign in to leave a comment.