Skip to content

Commit 61d61d8

Browse files
Adding get user account details by account id method based off username/userkey method (#814)
1 parent d938227 commit 61d61d8

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

atlassian/confluence.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2100,6 +2100,34 @@ def get_user_details_by_username(self, username, expand=None):
21002100

21012101
return response
21022102

2103+
def get_user_details_by_accountid(self, accountid, expand=None):
2104+
"""
2105+
Get information about a user through accountid
2106+
:param accountid: The account id
2107+
:param expand: OPTIONAL expand for get status of user.
2108+
Possible param is "status". Results are "Active, Deactivated"
2109+
:return: Returns the user details
2110+
"""
2111+
url = "rest/api/user"
2112+
params = {"accountId": accountid}
2113+
if expand:
2114+
params["expand"] = expand
2115+
2116+
try:
2117+
response = self.get(url, params=params)
2118+
except HTTPError as e:
2119+
if e.response.status_code == 403:
2120+
raise ApiPermissionError("The calling user does not have permission to view users", reason=e)
2121+
if e.response.status_code == 404:
2122+
raise ApiNotFoundError(
2123+
"The user with the given account does not exist",
2124+
reason=e,
2125+
)
2126+
2127+
raise
2128+
2129+
return response
2130+
21032131
def get_user_details_by_userkey(self, userkey, expand=None):
21042132
"""
21052133
Get information about a user through user key

0 commit comments

Comments
 (0)