Tickets

The following methods allow for interaction into the Tenable.sc Ticket API. These items are typically seen under the Worklow –> Tickets section of Tenable.sc. Methods available on sc.tickets:

class TicketAPI(api: APISession)[source]
create(name, assignee, **kw)[source]

Creates a ticket. ticket: create

Parameters:
  • name (str) – Required: The name for the ticket

  • assignee (dict) – Required: A dictionary containing one key (id) for the user the ticket is being assigned to

  • status (str, optional) – Optional status of the ticket: assigned, resolved, etc.

  • classification (str, optional) – Optional classification of the ticket type, i.e. Information, Other, etc.

  • description (str, optional) – Optional description for the ticket

  • notes (str, optional) – Optional notes associated with the ticket

  • queries (list, optional) – Optional list of IDs of queries to associate with the ticket

  • query (object, optional) – Optional query object

Returns:

The newly created ticket.

Return type:

dict

Examples

>>> ticket = sc.tickets.create('Example Ticket', {'id':1}, status='assigned', classification='information', description='This is an example ticket', notes='Example notes')
details(id, fields=None)[source]

Returns the details for a specific ticket. ticket: details

Parameters:
  • id (int) – Required: the unique identifier for the ticket to be returned

  • fields (list) – An optional list of attributes to return.

Returns:

The ticket resource record.

Return type:

dict

Examples

>>> ticket = sc.tickets.details(1)
>>> pprint(ticket)
edit(id, **kw)[source]

Edits a ticket. ticket: edit

Parameters:
  • id (int) – Required: unique identifier of the ticket to be edited

  • name (str) – Optional name for the ticket. Must not be blank.

  • assignee (dict) – Optional dictionary containing one key (id) for the user the ticket is being assigned to

  • status (str, optional) – Optional status of the ticket: assigned, resolved, etc. Must not be blank.

  • classification (str, optional) – Optional classification of the ticket type, i.e. Information, Other, etc. Must not be blank.

  • description (str, optional) – Optional description for the ticket

  • notes (str, optional) – Optional notes associated with the ticket

  • queries (list, optional) – Optional list of IDs of queries to associate with the ticket

  • query (object, optional) – Optional query object

Returns:

The newly updated ticket.

Return type:

dict

Examples

>>> ticket = sc.tickets.edit(1, status='Resolved', notes='ran updates')
list(fields=None)[source]

Outputs a dictionary of usable and manageable tickets, within which is a list of tickets. ticket: list

Parameters:

fields (list) – Optional list of attributes to return for each ticket, e.g. [“name”,”description”]. If not specified, only a list of ticket IDs will return

Returns:

A dictionary with two lists of ticket resources.

Return type:

dict

Examples

>>> for ticket in sc.tickets.list():
...     pprint(ticket)

Note: you cannot delete tickets, must set them to resolved and they will be auto-purged via system configured retention period