Tickets
- class Priority(...)
- delete()
Delete the resource. Requires the respective permission.
- 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
Truethe properties will contain additional information.
Note
if
EXPANDED_ATTRIBUTEScontains'*'expand will always beTrue
- 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 = ('created_by', 'updated_by')
- active
- created_at: datetime
- id
- name
- note
- parent
- ui_color: str | None
- ui_icon: str | None
- updated_at: datetime
- url
the API endpoint URL
- class Priorities(...)
- create(name, **kwargs)
Create a new priority.
- Parameters:
name (str) – priority identifier name
kwargs – additional priority properties
- Returns:
the newly created object
- Return type:
- iter(*args, **params)
Iterate through all objects.
With
paramsyou can also override the pagination defaults set inClient.paginationThe returned iterable can be used in for loops or fill a Python container like
listortuple.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
- 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
- endpoint: str
- url
- class State(...)
- delete()
Delete the resource. Requires the respective permission.
- 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
Truethe properties will contain additional information.
Note
if
EXPANDED_ATTRIBUTEScontains'*'expand will always beTrue
- 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 = ('created_by', 'state_type', 'updated_by')
- active
- created_at: datetime
- default_create: bool
- default_follow_up: bool
- id
- ignore_escalation: bool
- name
- note
- state_type: str
- updated_at: datetime
- url
the API endpoint URL
- class States(...)
- create(name, state_type_id, **kwargs)
Create a new state.
- Parameters:
name (str) – state name
state_type_id (int) – the states type id
kwargs – additional resource properties
- Returns:
the newly created object
- Return type:
- iter(*args, **params)
Iterate through all objects.
With
paramsyou can also override the pagination defaults set inClient.paginationThe returned iterable can be used in for loops or fill a Python container like
listortuple.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
- 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
- endpoint: str
- url
- class Ticket(...)
- add_tags(*names)
link given tags with ticket, if the tag is already linked with the ticket it will be ignored
- Parameters:
names (str) – tag names
- create_article(body, *, typ='note', internal=True, files=None, **kwargs)
Create a new article for the ticket.
- Parameters:
body (str) – article body text
typ (str) – article type
internal (bool) – article visibility
files (OptionalFiles) – attachment files
kwargs – additional article properties
- Returns:
the newly created article
- Return type:
- create_time_accounting(time_unit, **kwargs)
Add accounted time to ticket.
- Parameters:
time_unit (str | float) – accounted time units
kwargs – type(str |
TimeAccountingType)
- Return type:
TimeAccounting
- delete()
Delete the resource. Requires the respective permission.
- history()
Note
this method uses an undocumented API endpoint
- Returns:
the ticket’s history
- Return type:
List[StringKeyMapping]
- last_request_age_s()
- Returns:
time in seconds since the last request
- Return type:
float | None
- link_with(target, link_type='normal')
link the ticket with another one, if the link already exists it will be ignored
- Parameters:
target (
Ticket| int) – the target ticket or its idlink_type (Literal['normal', 'parent', 'child']) – specifies the relationship type
- links()
returns all linked tickets grouped by link type
To loop over all linked tickets at once use itertools.chain():
for linked_ticked in itertools.chain(*ticket.links().values()): print(linked_ticket)
- Returns:
{"normal": [Ticket, ...], "parent": [...], "child": [...]}- Return type:
Dict[str, List[Ticket]]
- merge_into(target)
merges the ticket into another
Note
this method uses an undocumented API endpoint
- reload(expand=False)
Update the object properties by requesting the current data from the server.
- Parameters:
expand –
if
Truethe properties will contain additional information.
Note
if
EXPANDED_ATTRIBUTEScontains'*'expand will always beTrue
- remove_tags(*names)
remove given tags from ticket, if the tag is not linked with the ticket it will be ignored
- Parameters:
names (str) – tag names
- tags()
- Returns:
- all tags that are related to the ticket as sent by
/tags?object=Ticket&o_id={ticket id} - Return type:
List[str]
- time_accountings()
- Returns:
all time accounting objects for the ticket.
- Return type:
List[TimeAccounting]
- unlink_from(target, link_type=None)
remove the link to another ticket, if the link does not exist it will be ignored
- Parameters:
target (
Ticket| int) – the target ticket or its idlink_type (Literal['normal', 'parent', 'child'] | None) – specifies the relationship type, if omitted the ticket_id will be looked up for every link_type
- update(**kwargs)
Update the ticket properties.
- Parameters:
kwargs – additional values to be updated
- Returns:
a new instance of the updated ticket
- Return type:
- view()
returns a mapping view of the objects internal properties as returned by the REST API.
- EXPANDED_ATTRIBUTES = ('article_ids', 'create_article_sender', 'create_article_type', 'created_by', 'customer', 'group', 'organization', 'owner', 'priority', 'state', 'ticket_time_accounting', 'ticket_time_accounting_ids', 'updated_by')
- article_count: int | None
- property articles: List[Article]
all articles related to the ticket as sent by
/ticket_articles/by_ticket/{ticket id}
- close_at: datetime | None
- close_escalation_at: datetime | None
- create_article_sender: str
- create_article_type: str
- created_at: datetime
- escalation_at: datetime | None
- first_response_at: datetime | None
- first_response_escalation_at: datetime | None
- id
- last_contact_agent_at: datetime | None
- last_contact_at: datetime | None
- last_contact_customer_at: datetime | None
- last_owner_update_at: datetime | None
- note: str | None
- number: str
- property organization: Organization | None
- time_unit: str | None
- title: str
- update_escalation_at: datetime | None
- updated_at: datetime
- url
the API endpoint URL
- property weburl: str
URL of the ticket in the webclient
- class Tickets(...)
- create(title, group, customer, article, **kwargs)
Create a new ticket.
- Parameters:
title (str) – ticket title
group (str | int) – group name or id
customer (str | int) – customer email or id, you can also use guess:<email>
article (str | StringKeyMapping) – the text body of the first ticket article or the article mapping
kwargs – additional ticket properties
- Returns:
An instance of the created ticket.
- Return type:
- iter(*args, **params)
Iterate through all objects.
With
paramsyou can also override the pagination defaults set inClient.paginationThe returned iterable can be used in for loops or fill a Python container like
listortuple.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
- 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
listortuple.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 = 100
controls the LRU cache behaviour
LRU disabled, cache unbounded (-1)
disable caching (0)
limited LRU caching (>0)
- cache
resource LRU cache
- endpoint: str
- url
- class Tags(...)
This class manages the
/tags,/tag_listand/tag_searchendpoint.- add_to_ticket(tid, *names)
add one or more tags to the specified ticket, if the tag is already linked with the ticket it is ignored
- Parameters:
tid (int) – the ticket id
names (str) – tag names
- by_ticket(tid)
all tags that are associated with a ticket
- Parameters:
tid (int) – the ticket id
- Returns:
ticket tags
- Return type:
List[str]
- create(name)
creates a new tag (admin only), if name already exists, it is ignored
- delete(name)
deletes an existing tag (admin only)
- Parameters:
name (str) – tag name
- Raises:
KeyErrorif not found
- reload()
reloads the tag cache
- remove_from_ticket(tid, *names)
remove one or more tags from the specified ticket, if the tag is not linked with the ticket it is ignored
- Parameters:
tid (int) – the ticket id
names (str) – tag names
- rename(name, new_name)
rename an existing tag (admin only)
if the new name already exists, the current name will be deleted
- Parameters:
name (str) – the current name
new_name (str) – new name
- Raises:
KeyErrorif not found
- search(term)
find matching tags
- Parameters:
term (str) – search term
- Returns:
search results
- Return type:
List[str]