Skip to content

Creating users and groups

Like other objects in the SDK, you can create users and groups using the builder pattern.

Create a group

1.3.3 1.0.0

For example, to create a group:

Create a group
1
2
3
AtlanGroup group = AtlanGroup.creator("Example Group") // (1)
    .build(); // (2)
String guid = group.create(); // (3)
  1. When creating a group, you must specify at least its name.
  2. Like other builder patterns, you build the object to make it ready for creation.
  3. To actually create the group in Atlan, call the create() method on the built object. Note that it will return the GUID of the group that was created when successful.
Create a group
1
2
3
4
5
6
from pyatlan.model.group import AtlanGroup
from pyatlan.client.atlan import AtlanClient

client = AtlanClient()
group = AtlanGroup.create(alias="Example Group")  # (1)
guid = client.group.create(group).group  # (2)
  1. When creating a group, you must specify at least its name.
  2. To actually create the group in Atlan, call the group.create() method with the built object. Note that it will return a minimal object that includes the GUID of the group that was created in the group property.
Create a group
1
2
3
val group = AtlanGroup.creator("Example Group") // (1)
    .build() // (2)
val guid = group.create() // (3)
  1. When creating a group, you must specify at least its name.
  2. Like other builder patterns, you build the object to make it ready for creation.
  3. To actually create the group in Atlan, call the create() method on the built object. Note that it will return the GUID of the group that was created when successful.
POST /api/service/groups
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
{
  "group": { // (1)
    "attributes": { // (2)
      "alias": [ // (3)
        "Example Group"
      ],
      "isDefault": [ // (4)
        "false"
      ]
    },
    "name": "example_group" // (5)
  }
}
  1. All the details for the group must be wrapped in a group object.
  2. The details of the group are further nested within an attributes object.
  3. Provide an alias for the group, which will be the name that appears in the UI. Note that it must be specified as an array, even though there is only a single value.
  4. Specify whether the group should be applied to all new users (true) or not (false). Note that this must be specified as a string within an array.
  5. Provide an internal name for the group.

    Must follow certain constraints

    The internal name for the group must be unique, all lowercase, and include only alphanumeric characters and the _ (no spaces or special characters).

Create a user

To create a user, what you're really doing is inviting them. The users will need to verify their email address to activate their account, and will be able to specify their own password as part of that process.

2.0.4 1.0.0

To invite a user:

Invite a user
1
2
3
4
5
AtlanUser user = AtlanUser.creator(
        "someone@somewhere.org", // (1)
        "$member") // (2)
    .build(); // (3)
user.create(); // (4)
  1. When inviting a user, you must specify at least their email address...
  2. ...and the workspace role you want to give that user (one of $guest, $member, or $admin).
  3. Like other builder patterns, you build the object to make it ready for creation.
  4. To actually invite the user to Atlan, call the create() method on the built object. Note that this does not return any information.
Invite a user
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
from pyatlan.model.user import AtlanUser
from pyatlan.client.atlan import AtlanClient

client = AtlanClient()
users = [
    AtlanUser.create(
        email="someone@somewhere.org",  # (1)
        role_name="$member"  # (2)
    )
]
client.user.create(users, return_info=False)  # (3)
  1. When inviting a user, you must specify at least their email address...
  2. ...and the workspace role you want to give that user (one of $guest, $member, or $admin).
  3. To invite the user to Atlan, simply call the user.create() method with the built object. Note that if return_info is set to True, this will return a list containing details of the created users; otherwise, it will return None.
Invite a user
1
2
3
4
5
val user = AtlanUser.creator(
        "someone@somewhere.org", // (1)
        "\$member") // (2)
    .build() // (3)
user.create() // (4)
  1. When inviting a user, you must specify at least their email address...
  2. ...and the workspace role you want to give that user (one of \$guest, \$member, or \$admin).
  3. Like other builder patterns, you build the object to make it ready for creation.
  4. To actually invite the user to Atlan, call the create() method on the built object. Note that this does not return any information.
POST /api/service/users
1
2
3
4
5
6
7
8
9
{
  "users": [ // (1)
    {
      "email": "someone@somewhere.org", // (2)
      "roleName": "$member", // (3)
      "roleId": "be5f0df7-dab8-4107-8bf0-56ce7131623a" // (4)
    }
  ]
}
  1. All user details must be wrapped in a users array, where each object in the array defines a single user.
  2. You must provide a valid email address for each user. Atlan will send an invitation to this email address.
  3. You must specify the role for the user, one of: $admin, $member, or $guest.
  4. You must also provide the unique ID (GUID) of the role.

    You probably need to look this up first

    When using the raw API, you will need to lookup the role GUID yourself. You can GET /api/service/roles, and the GUID will be the id field in the response for each role.