Helpdesk Ticket¶
Added in version 3.0.0.
Requires Redmine >= 5.0 and the redmine_expert_helpdesk plugin >= 0.20.0. The Helpdesk module has
to be enabled in the project.
A helpdesk ticket is a Redmine issue with helpdesk data attached (contact, mailbox, SLA state and message history), the ticket id is the issue id.
Note
This resource targets redmine_expert_helpdesk and is not compatible with RedmineUP’s Helpdesk
plugin, which uses different endpoints and payloads.
Manager¶
All operations on the HelpdeskTicket resource are provided by its manager. To get access to it
you have to call redmine.helpdesk_ticket where redmine is a configured redmine object.
See the Configuration about how to configure redmine object.
Create methods¶
create¶
- redminelib.managers.ResourceManager.create(**fields)
Creates new HelpdeskTicket resource, i.e. a new issue linked to a helpdesk contact. Accepts all issue fields (see Issue) plus the helpdesk specific fields below. Attachments are not supported.
- Parameters:
project_id (int or string) – (required). Id or identifier of ticket’s project.
subject (string) – (required). Ticket subject.
contact_id (int) – (optional). Id of an existing contact of the same project.
contact_email (string) – (optional). Email of the contact, the contact is created if it doesn’t exist.
contact_name (string) – (optional). Name used when a new contact is created.
- Returns:
Resource object
>>> ticket = redmine.helpdesk_ticket.create(
... project_id='support',
... tracker_id=3,
... subject='Printer on fire',
... description='Please help',
... contact_email='jane@example.com',
... contact_name='Jane Doe'
... )
>>> ticket
<redminelib.resources.HelpdeskTicket #42 "Printer on fire">
new¶
- redminelib.managers.ResourceManager.new()
Creates new empty HelpdeskTicket resource but saves it only when
save()is called. Valid attributes are the same as forcreate()method above.- Returns:
Resource object
Read methods¶
get¶
- redminelib.managers.ResourceManager.get(resource_id, **params)
Returns single HelpdeskTicket resource by its (issue) id.
- Parameters:
resource_id (int) – (required). Id of the ticket.
include (list) – (optional). Fetches associated data in one call. Accepted values:
messages
- Returns:
Resource object
>>> ticket = redmine.helpdesk_ticket.get(42, include=['messages'])
>>> ticket.contact
<redminelib.resources.HelpdeskContact #1 "Jane Doe">
>>> ticket.sla['reaction']['status']
'running'
>>> ticket.messages[0]['direction']
'in'
Hint
Messages are lazy loaded if not requested via include, and the full issue is available via the
issue attribute:
>>> ticket = redmine.helpdesk_ticket.get(42)
>>> ticket.messages
[{'id': 9, 'direction': 'in', ...}]
>>> ticket.issue
<redminelib.resources.Issue #42 "Printer on fire">
all¶
Not supported by the Helpdesk plugin
filter¶
- redminelib.managers.ResourceManager.filter(**filters)
Returns visible HelpdeskTicket resources of a project, newest first.
- Parameters:
project_id (int or string) – (required). Id or identifier of tickets’ project.
limit (int) – (optional). How much resources to return.
offset (int) – (optional). Starting from what resource to return the other resources.
- Returns:
ResourceSet object
>>> tickets = redmine.helpdesk_ticket.filter(project_id='support')
>>> tickets
<redminelib.resultsets.ResourceSet object with HelpdeskTicket resources>
Hint
For richer filtering use the issue resource, the plugin adds helpdesk_kunde, helpdesk_sla_reaction,
helpdesk_sla_solution and helpdesk_awaiting_agent issue filters, see Issue.
Update methods¶
update¶
- redminelib.managers.ResourceManager.update(resource_id, **fields)
Updates values of given fields of a HelpdeskTicket resource. Accepts the same fields as
create()(exceptproject_id) andnotesto add a journal note.- Parameters:
resource_id (int) – (required). Ticket id.
- Returns:
True
>>> redmine.helpdesk_ticket.update(42, status_id=2, notes='Replaced toner')
True
save¶
- redminelib.resources.HelpdeskTicket.save(**attrs)
Saves current state of a HelpdeskTicket resource.
- Returns:
Resource object
>>> ticket = redmine.helpdesk_ticket.get(42)
>>> ticket.save(assigned_to_id=5)
<redminelib.resources.HelpdeskTicket #42 "Printer on fire">
Delete methods¶
delete¶
- redminelib.managers.ResourceManager.delete(resource_id)
Deletes a HelpdeskTicket together with its issue and helpdesk messages (since plugin 0.20.1, before that messages were unlinked). The same happens when the issue is deleted through Redmine itself.
- Parameters:
resource_id (int) – (required). Ticket id.
- Returns:
True
>>> redmine.helpdesk_ticket.delete(42)
True
Export¶
Not supported by the Helpdesk plugin