Users

class User(...)
delete()

Delete the resource. Requires the respective permission.

group_access(group)
Parameters:

group (int | Group) – group object or group id

Returns:

a list of all access rights for a given group

Return type:

List[str]

last_request_age_s()
Returns:

time in seconds since the last request

Return type:

float | None

reload(expand=False)

Update the object properties by requesting the current data from the server.

Parameters:

expand – if True the properties will contain additional information.

Note

if EXPANDED_ATTRIBUTES contains '*' expand will always be True

update(**kwargs)

Update the resource properties.

Parameters:

kwargs – values to be updated (depending on the resource)

Returns:

a new instance of the updated resource

Return type:

same as object

view()

returns a mapping view of the objects internal properties as returned by the REST API.

EXPANDED_ATTRIBUTES: Tuple[str, ...] = ('authorizations', 'created_by', 'groups', 'organizations', 'overview_sortings', 'roles', 'two_factor_preferences', 'updated_by')
active: bool
created_at: datetime
created_by: User
department: str | None
email: str
fax: str
firstname: str
property fullname: str

users firstname and lastname combined, or email

property groups: List[Group]
id: int
image: str | None
last_login: datetime | None
lastname: str
login: str

users login name

login_failed: int
property longname: str

users fullname with organization

mobile: str
name: str

alias for login

note: str | None
property organization: Organization | None
property organizations: List[Organization]
out_of_office: bool
out_of_office_end_at: datetime | None
out_of_office_replacement: User | None
out_of_office_start_at: datetime | None
parent: Users
phone: str
property roles: List[Role]
updated_at: datetime
updated_by: User
url: str

the API endpoint URL

verified: bool
vip: bool
web: str
property weburl: str

URL of the user profile in the webclient

class Users(...)
create(*, firstname=None, lastname=None, email=None, phone=None, **kwargs)

Create a new zammad user.

Parameters:
  • firstname (str | None) – users first name

  • lastname (str | None) – users last name

  • email (str | None) – users email address

  • phone (str | None) – users phone number

  • kwargs – additional user properties

iter(*args, **params)

Iterate through all objects.

With params you can also override the pagination defaults set in Client.pagination

The returned iterable can be used in for loops or fill a Python container like list or tuple.

items = tuple(resource.iter(...))

for item in resource.iter(page=5, page_size=20, expand=True):
    print(item)
Parameters:
  • args – additional endpoint arguments

  • params – additional pagination options like page, page_size, extend

me()
Returns:

Return the authenticated user.

Return type:

User

search(query, *, sort_by=None, order_by=None, **params)

Search for objects with query syntax.

The returned iterable can be used in for loops or fill a Python container like list or tuple.

items = tuple(resource.search(...))

for item in resource.search(...):
    print(item)
Parameters:
  • query (str) – query string

  • sort_by (str | None) – sort by a specific property (e.g. ‘name’ or ‘created_at’)

  • order_by (Literal['asc', 'desc', None]) – sort direction

  • params – additional pagination options like page, page_size, extend

DEFAULT_CACHE_SIZE = -1

controls the LRU cache behaviour

  • LRU disabled, cache unbounded (-1)

  • disable caching (0)

  • limited LRU caching (>0)

cache

resource LRU cache

property client: Client
endpoint: str
url