0
# Administration
1
2
Comprehensive user directory management, cloud administration, and marketplace integration providing complete control over Atlassian ecosystem administration, user provisioning, and application lifecycle management.
3
4
## Crowd - User Directory Management
5
6
Crowd REST API client for centralized user authentication, directory services, and single sign-on management across Atlassian applications.
7
8
### Initialization
9
10
```python { .api }
11
class Crowd(AtlassianRestAPI):
12
def __init__(self, url: str, username: str = None, password: str = None,
13
token: str = None, **kwargs):
14
"""
15
Initialize Crowd client.
16
17
Parameters:
18
- url (str): Base URL of Crowd instance
19
- username (str, optional): Username for authentication
20
- password (str, optional): Password for authentication
21
- token (str, optional): Bearer token for authentication
22
"""
23
```
24
25
### User Management
26
27
```python { .api }
28
def get_users(self, start: int = 0, limit: int = 50) -> List[dict]:
29
"""
30
Get all users.
31
32
Parameters:
33
- start: Starting index for pagination
34
- limit: Maximum results to return
35
36
Returns:
37
List[dict]: Users list with profile information
38
"""
39
40
def get_user(self, username: str) -> T_resp_json:
41
"""
42
Get user details.
43
44
Parameters:
45
- username: Username to retrieve
46
47
Returns:
48
dict: User profile with attributes and group memberships
49
"""
50
51
def create_user(self, username: str, email: str, first_name: str,
52
last_name: str, display_name: Optional[str] = None,
53
password: Optional[str] = None, active: bool = True) -> T_resp_json:
54
"""
55
Create user.
56
57
Parameters:
58
- username: Unique username
59
- email: Email address
60
- first_name: First name
61
- last_name: Last name
62
- display_name: Display name (defaults to first + last name)
63
- password: Initial password
64
- active: User active status
65
66
Returns:
67
dict: Created user data
68
"""
69
70
def update_user(self, username: str, email: Optional[str] = None,
71
first_name: Optional[str] = None, last_name: Optional[str] = None,
72
display_name: Optional[str] = None, active: Optional[bool] = None) -> T_resp_json:
73
"""
74
Update user.
75
76
Parameters:
77
- username: Username to update
78
- email: New email address
79
- first_name: New first name
80
- last_name: New last name
81
- display_name: New display name
82
- active: New active status
83
84
Returns:
85
dict: Updated user data
86
"""
87
88
def delete_user(self, username: str) -> bool:
89
"""
90
Delete user.
91
92
Parameters:
93
- username: Username to delete
94
95
Returns:
96
bool: True if deletion successful
97
"""
98
99
def search_users(self, query: str, start: int = 0, limit: int = 50) -> List[dict]:
100
"""
101
Search users.
102
103
Parameters:
104
- query: Search query (username, email, name)
105
- start: Starting index
106
- limit: Maximum results
107
108
Returns:
109
List[dict]: Matching users
110
"""
111
```
112
113
### Authentication
114
115
```python { .api }
116
def authenticate_user(self, username: str, password: str) -> bool:
117
"""
118
Authenticate user credentials.
119
120
Parameters:
121
- username: Username to authenticate
122
- password: Password to verify
123
124
Returns:
125
bool: True if authentication successful
126
"""
127
128
def is_user_authenticated(self, username: str, token: str) -> bool:
129
"""
130
Check if user token is valid.
131
132
Parameters:
133
- username: Username
134
- token: Authentication token
135
136
Returns:
137
bool: True if token is valid
138
"""
139
140
def reset_user_password(self, username: str) -> T_resp_json:
141
"""
142
Reset user password.
143
144
Parameters:
145
- username: Username to reset password for
146
147
Returns:
148
dict: Password reset result
149
"""
150
```
151
152
### Group Management
153
154
```python { .api }
155
def get_groups(self, start: int = 0, limit: int = 50) -> List[dict]:
156
"""
157
Get all groups.
158
159
Parameters:
160
- start: Starting index
161
- limit: Maximum results
162
163
Returns:
164
List[dict]: Groups list
165
"""
166
167
def create_group(self, name: str, description: Optional[str] = None,
168
active: bool = True) -> T_resp_json:
169
"""
170
Create group.
171
172
Parameters:
173
- name: Group name
174
- description: Group description
175
- active: Group active status
176
177
Returns:
178
dict: Created group data
179
"""
180
181
def add_user_to_group(self, username: str, group_name: str) -> T_resp_json:
182
"""
183
Add user to group.
184
185
Parameters:
186
- username: Username to add
187
- group_name: Target group name
188
189
Returns:
190
dict: Operation result
191
"""
192
193
def remove_user_from_group(self, username: str, group_name: str) -> T_resp_json:
194
"""
195
Remove user from group.
196
197
Parameters:
198
- username: Username to remove
199
- group_name: Source group name
200
201
Returns:
202
dict: Operation result
203
"""
204
205
def get_group_members(self, group_name: str, start: int = 0,
206
limit: int = 50) -> List[dict]:
207
"""
208
Get group members.
209
210
Parameters:
211
- group_name: Group name
212
- start: Starting index
213
- limit: Maximum results
214
215
Returns:
216
List[dict]: Group members
217
"""
218
```
219
220
## Cloud Administration
221
222
Atlassian Cloud organization and user administration for enterprise-level management and compliance.
223
224
### Organization Management
225
226
```python { .api }
227
class CloudAdminOrgs(AtlassianRestAPI):
228
def __init__(self, url: str, username: str = None, password: str = None,
229
token: str = None, **kwargs):
230
"""
231
Initialize Cloud Admin Organizations client.
232
233
Parameters:
234
- url (str): Base URL of Atlassian Cloud admin API
235
- username (str, optional): Username for authentication
236
- password (str, optional): Password or API token
237
- token (str, optional): Bearer token for authentication
238
"""
239
240
def get_orgs(self) -> List[dict]:
241
"""
242
Get organizations.
243
244
Returns:
245
List[dict]: Organizations list with details
246
"""
247
248
def get_org(self, org_id: str) -> T_resp_json:
249
"""
250
Get organization details.
251
252
Parameters:
253
- org_id: Organization ID
254
255
Returns:
256
dict: Organization information with settings and policies
257
"""
258
259
def get_org_users(self, org_id: str, start: int = 0, limit: int = 50) -> T_resp_json:
260
"""
261
Get organization users.
262
263
Parameters:
264
- org_id: Organization ID
265
- start: Starting index
266
- limit: Maximum results
267
268
Returns:
269
dict: Organization users with roles and permissions
270
"""
271
272
def get_org_domains(self, org_id: str) -> List[dict]:
273
"""
274
Get organization domains.
275
276
Parameters:
277
- org_id: Organization ID
278
279
Returns:
280
List[dict]: Verified domains for organization
281
"""
282
283
def get_org_policies(self, org_id: str) -> T_resp_json:
284
"""
285
Get organization policies.
286
287
Parameters:
288
- org_id: Organization ID
289
290
Returns:
291
dict: Security and compliance policies
292
"""
293
```
294
295
### User Administration
296
297
```python { .api }
298
class CloudAdminUsers(AtlassianRestAPI):
299
def __init__(self, url: str, username: str = None, password: str = None,
300
token: str = None, **kwargs):
301
"""
302
Initialize Cloud Admin Users client.
303
304
Parameters:
305
- url (str): Base URL of Atlassian Cloud admin API
306
- username (str, optional): Username for authentication
307
- password (str, optional): Password or API token
308
- token (str, optional): Bearer token for authentication
309
"""
310
311
def get_profile(self, account_id: str) -> T_resp_json:
312
"""
313
Get user profile.
314
315
Parameters:
316
- account_id: User account ID
317
318
Returns:
319
dict: User profile information
320
"""
321
322
def get_manage_account(self, account_id: str) -> T_resp_json:
323
"""
324
Get user account management info.
325
326
Parameters:
327
- account_id: User account ID
328
329
Returns:
330
dict: Account management details and permissions
331
"""
332
333
def get_api_tokens(self, account_id: str) -> List[dict]:
334
"""
335
Get user API tokens.
336
337
Parameters:
338
- account_id: User account ID
339
340
Returns:
341
List[dict]: Active API tokens for user
342
"""
343
344
def suspend_user(self, account_id: str, reason: str) -> T_resp_json:
345
"""
346
Suspend user account.
347
348
Parameters:
349
- account_id: User account ID
350
- reason: Suspension reason
351
352
Returns:
353
dict: Suspension result
354
"""
355
356
def restore_user(self, account_id: str) -> T_resp_json:
357
"""
358
Restore suspended user.
359
360
Parameters:
361
- account_id: User account ID
362
363
Returns:
364
dict: Restoration result
365
"""
366
```
367
368
## Marketplace Integration
369
370
Atlassian Marketplace API client for app lifecycle management, licensing, and vendor operations.
371
372
### Initialization
373
374
```python { .api }
375
class MarketPlace(AtlassianRestAPI):
376
def __init__(self, url: str, username: str = None, password: str = None,
377
token: str = None, **kwargs):
378
"""
379
Initialize Marketplace client.
380
381
Parameters:
382
- url (str): Base URL of Atlassian Marketplace API
383
- username (str, optional): Username for authentication
384
- password (str, optional): Password or API token
385
- token (str, optional): Bearer token for authentication
386
"""
387
```
388
389
### App Management
390
391
```python { .api }
392
def get_addon_info(self, addon_key: str) -> T_resp_json:
393
"""
394
Get addon information.
395
396
Parameters:
397
- addon_key: Addon key
398
399
Returns:
400
dict: Addon details with versions and compatibility
401
"""
402
403
def get_hosted_addon_info(self, addon_key: str) -> T_resp_json:
404
"""
405
Get hosted addon information.
406
407
Parameters:
408
- addon_key: Hosted addon key
409
410
Returns:
411
dict: Hosted addon configuration and status
412
"""
413
414
def get_addon_properties(self, addon_key: str) -> T_resp_json:
415
"""
416
Get addon properties.
417
418
Parameters:
419
- addon_key: Addon key
420
421
Returns:
422
dict: Addon properties and configuration
423
"""
424
425
def install_addon(self, addon_key: str, version: Optional[str] = None) -> T_resp_json:
426
"""
427
Install marketplace addon.
428
429
Parameters:
430
- addon_key: Addon key to install
431
- version: Specific version (latest if not specified)
432
433
Returns:
434
dict: Installation result
435
"""
436
437
def uninstall_addon(self, addon_key: str) -> T_resp_json:
438
"""
439
Uninstall addon.
440
441
Parameters:
442
- addon_key: Addon key to uninstall
443
444
Returns:
445
dict: Uninstallation result
446
"""
447
```
448
449
## Usage Examples
450
451
### Crowd User Management
452
453
```python
454
from atlassian import Crowd
455
456
crowd = Crowd(
457
url="https://crowd.company.com",
458
username="admin",
459
password="admin-password"
460
)
461
462
# Create user
463
user = crowd.create_user(
464
username="john.doe",
465
email="john.doe@company.com",
466
first_name="John",
467
last_name="Doe",
468
password="initial-password"
469
)
470
471
# Authenticate user
472
is_valid = crowd.authenticate_user("john.doe", "user-password")
473
474
# Search users
475
users = crowd.search_users("john")
476
477
# Create group and add user
478
group = crowd.create_group(
479
name="developers",
480
description="Development team members"
481
)
482
483
crowd.add_user_to_group("john.doe", "developers")
484
485
# Get group members
486
members = crowd.get_group_members("developers")
487
```
488
489
### Cloud Administration
490
491
```python
492
from atlassian import CloudAdminOrgs, CloudAdminUsers
493
494
# Organization management
495
org_admin = CloudAdminOrgs(
496
url="https://admin.atlassian.com",
497
username="admin@company.com",
498
password="api-token"
499
)
500
501
orgs = org_admin.get_orgs()
502
org_details = org_admin.get_org(orgs[0]["id"])
503
org_users = org_admin.get_org_users(orgs[0]["id"])
504
505
# User administration
506
user_admin = CloudAdminUsers(
507
url="https://admin.atlassian.com",
508
username="admin@company.com",
509
password="api-token"
510
)
511
512
# Get user profile
513
profile = user_admin.get_profile("account-id-123")
514
515
# Suspend user
516
suspension = user_admin.suspend_user(
517
"account-id-123",
518
"Policy violation - unauthorized access"
519
)
520
521
# Get user's API tokens
522
tokens = user_admin.get_api_tokens("account-id-123")
523
```
524
525
### Marketplace Management
526
527
```python
528
from atlassian import MarketPlace
529
530
marketplace = MarketPlace(
531
url="https://marketplace.atlassian.com",
532
username="vendor@company.com",
533
password="api-token"
534
)
535
536
# Get addon information
537
addon_info = marketplace.get_addon_info("com.company.awesome-addon")
538
539
# Install addon
540
installation = marketplace.install_addon(
541
"com.company.awesome-addon",
542
version="2.1.0"
543
)
544
545
# Get addon properties
546
properties = marketplace.get_addon_properties("com.company.awesome-addon")
547
```
548
549
### Integrated Administration Workflow
550
551
```python
552
def provision_new_employee(employee_data):
553
"""Complete employee provisioning workflow."""
554
555
# Create user in Crowd
556
user = crowd.create_user(
557
username=employee_data["username"],
558
email=employee_data["email"],
559
first_name=employee_data["first_name"],
560
last_name=employee_data["last_name"],
561
password=generate_initial_password()
562
)
563
564
# Add to appropriate groups based on role
565
role_groups = {
566
"developer": ["jira-software-users", "confluence-users", "bitbucket-users"],
567
"manager": ["jira-administrators", "confluence-administrators"],
568
"support": ["jira-servicedesk-users"]
569
}
570
571
for group in role_groups.get(employee_data["role"], []):
572
try:
573
crowd.add_user_to_group(employee_data["username"], group)
574
except Exception as e:
575
print(f"Failed to add user to group {group}: {e}")
576
577
# If cloud environment, ensure org membership
578
if cloud_environment:
579
org_admin.add_user_to_org(
580
org_id="company-org-id",
581
account_id=user["account_id"]
582
)
583
584
# Send welcome email with credentials
585
send_welcome_email(
586
employee_data["email"],
587
employee_data["username"],
588
initial_password
589
)
590
591
return user
592
593
def audit_user_access():
594
"""Audit user access across Atlassian products."""
595
596
# Get all users from Crowd
597
all_users = crowd.get_users(limit=1000)
598
599
audit_report = []
600
for user in all_users:
601
user_info = {
602
"username": user["name"],
603
"email": user["email"],
604
"active": user["active"],
605
"groups": [],
606
"last_login": user.get("lastAuthenticated")
607
}
608
609
# Get group memberships
610
try:
611
groups = crowd.get_user_groups(user["name"])
612
user_info["groups"] = [g["name"] for g in groups]
613
except Exception as e:
614
user_info["error"] = str(e)
615
616
audit_report.append(user_info)
617
618
return audit_report
619
```
620
621
## Error Handling
622
623
```python
624
from atlassian.errors import ApiNotFoundError, ApiPermissionError, ApiConflictError
625
626
try:
627
user = crowd.create_user("existing-user", "email@example.com", "John", "Doe")
628
except ApiConflictError:
629
print("User already exists")
630
except ApiPermissionError:
631
print("Insufficient permissions to create user")
632
```
633
634
## Types
635
636
```python { .api }
637
from atlassian.typehints import T_id, T_resp_json
638
from typing import List, Dict, Optional
639
640
# Crowd types
641
Username = str
642
GroupName = str
643
AuthenticationToken = str
644
645
# Cloud Admin types
646
OrganizationId = str
647
AccountId = str
648
PolicyType = str
649
650
# Marketplace types
651
AddonKey = str
652
AddonVersion = str
653
```