Incident API
The AlertFind Incident API allows you to perform external operations on the Incident template and Incidents. It enables you to:
- Find a list of Incident templates based on your search criteria.
- Open an Incident based on an already created Incident template.
- (Optional) Override the message content of an Incident template task.
In the previous releases of AlertFind, opening an incident was done using the Notification API (via the sendScenario method). While this method is usable in the Notification API, it is now deprecated.
Classes included in the Incident API include:
AlertFindIncidentServiceNotificationTaskSearchConstraintUIIncidentTemplateSearchOptionsIncidentTemplate
AlertFindIncident
The AlertFindIncident class includes the following methods:
openIncidentByQuickLaunchIDopenIncidentByTemplateIDfindTemplatecountTemplate
openIncidentByQuickLaunchID
The openIncidentByQuickLaunchID method launches an incident based on the given quick launch ID. A user can optionally specify a list of notification tasks to this method, which defines any overrides to the subject and/or body of a NotificationTask defined for the Incident. Overrides can specify a new subject, and new body, or both. These overrides are only for the specific incident being launched and will not be applied to the incident template itself.
For this to work, overriding tasks must specify the correct NotificationTask ID to override. Also, note that overrides can only be specified in the default language of the API user.
The syntax of the openIncidentByQuickLaunchID method is:
public void openIncidentByQuickLaunchID (
String quickLaunchID,
NotificationTask[] overrides
)
where:
quickLaunchIDis the launch ID of the incident to be launched.overridesis an array ofNotificationTaskinstance. Optionally, it overrides the subject and body of any matchingNotificationTaskdefined in the incident template.
openIncidentByTemplateID
The openIncidentByTemplateID method launches an incident based on the given Incident template ID. A user can optionally specify a list of NotificationTasks to this method, which defines any overrides to the subject and/or body of a Notification Task defined for the Incident. Overrides can specify a new subject, and new body, or both. These overrides are only for the specific incident being launched and will not be applied to the incident template itself.
For this to work, overriding tasks must specify the correct NotificationTask ID to override. Also, note that overrides can only be specified in the default language of the API user.
The syntax of the openIncidentByTemplateID method is:
public long openIncidentByTemplateID (
Long templateID,
NotificationTask[] overrides
)
where:
templateIDis the incident template ID of the incident to be launched.overridesis an array ofNotificationTaskinstance. Optionally, it overrides the subject and body of any matchingNotificationTaskdefined in the incident template.
findTemplate
The findTemplate method retrieves a list of Incident templates based on a search criteria. It accepts a single parameter options that defines the search criteria. If the parameter options is defined, results are scoped on the role of the API user. Following are the various criteria options available:
teamNamesearches for incident templates on this team. If undefined, results are scoped based on the role of the API user.includeSubTeamsincludes sub-teams in the search ifteamNameis defined. If undefined, defaults to a value offalse.idretrieves a specific incident template by ID.nameretrieves a specific incident template by name.
The syntax of the findTemplate method is:
public IncidentTemplate[] findTemplate (
final IncidentTemplateSearchOptions options
) throws PermissionDeniedException,
InvalidArgumentException;
where:
optionsis a specific search criteria.
Results of the this method are scoped based on the security model, which takes into account the specific role of the API user. Following are the results of querying findTemplate method:
- As an administrator, you can access all incident templates defined in the customer's instance.
- A team leader can access all Incident templates defined in his or her team and sub-teams.
- A normal user do not have access to incident templates, and cannot retrieve results.
countTemplate
The countTemplate counts the number of Incident Templates based on a search criteria.
The syntax of the openIncidentByTemplateID method is:
public int openIncidentByTemplateID (
final IncidentTemplateSearchOptions options
) throws PermissionDeniedException,
InvalidArgumentException;
where:
IncidentTemplateSearchOptionsis the specific search criteria option.
NotificationTask
The NotificationTask object used in the AlertFindIncident class provides a list of notification tasks.
The syntax of the NotificationTask class is:
public void NotificationTask {
Long id,
String subject,
String body
}
where:
idis the notification task ID.subjectis the subject of the notification.bodyis the body of the notification.
SearchConstraintUI
The SearchConstraintUI class object used in the AlertFindIncident class allows you to edit the search criteria to filter and find a list of incident templates based on the criteria set.
The syntax of the SearchConstraintUI class is:
public void SearchConstraintUI (
String operator,
String property,
String value
)
where:
operatorprovides a list of filtering options.propertyis the custom field name.valueis the value to be used along with the filtering option to sort the incident templates.
IncidentTemplateSearchOptions
The IncidentTemplateSearchOptions class opens an incident template based on a search criteria.
The syntax of the IncidentTemplateSearchOptions class is:
public void IncidentTemplateSearchOptions {
Boolean isShowSubTeamIncidentTemplates;
String teamName;
String[] sort;
Integer start;
Integer limit;
SearchConstraintUI[] constraints;
}
where:
isShowSubTeamIncidentTemplatesincludes sub-teams incident templates in the search ifteamNameis defined. If undefined, defaults to a value offalse.teamNamesearches for incident templates on this team. If undefined, results are scoped based on the role of the API user.sortis an array ofString. It sorts the incident templates based on the search criteria.startstarts the sorting of templates.limitnarrows the search constraint to refine the list of incident templates displayed.constraintsis an array ofSearchConstraintUIarray. It is the filtering option to be used for searching the template.
IncidentTemplate
The IncidentTemplate object used in the AlertFindIncident class opens an Incident based on an already created Incident template.
The syntax of the IncidentTemplate class is:
public void IncidentTemplate {
long id;
String name;
String description;
String quickLaunchId;
String teamName;
NotificationTask[] notificationTasks;
}
where:
idis the incident template ID.nameis the name of the incident template.descriptionis the description of the incident template.quickLaunchIdis the quick launch ID of the incident template to be launched.teamNamesearches for incident templates on this team. If undefined, results are scoped based on the role of the API user.notificationTasksis an array ofNotificationTask.