Why all this, I have a Jira REST API, right?

Once the connection is established, you will have access to a REST endpoint to create/edit incidents. When creating incidents, 2 parameters are mandatory: event identifier and rule. Rules are required to identify the cause of the event. You can read more about rules here

The REST API that exists in Jira is enough to create incidents/issues. But Alert Catcher has several advantages. We will consider some of them in more detail.

Binding to an event identifier from a third-party system

For example, you created an incident, it has an ID of 777-XXX in your system. After a while, the incident on your third-party system ceased to be relevant, it was resolved or perhaps the data was updated.

In order to update the incident data in Jira, you need to find the incident ID 777-XXX in the list of all project isues or store key value pairs somewhere (the incident ID matches the Jira issue key). This issue is taken over by Alert Catcher. You can update the status of the incident, knowing only its identifier.

API-key

Unlike the Jira REST API, where you use Bearer auth to authenticate the user to create the issue, in Alert Catcher you specify a separate API-key parameter in the request header.

Even if an attacker gets your API key, he will not be able to use it to call any other REST API methods.

Default issue type, reporter and project

Since in the connection settings you have already specified the default incident reporter, the project to which incidents will be created and the issue type, you don't need to specify this setting each time you send a request.

Restrictions on Incident Creation

Alert Catcher allows:

REST-resource and API-key

To view the REST resource for creating incidents, click the Connection settings tab.


You will also need an API-key. You can get the API-key on the Security tab:


Incident creation


This page shows examples of how to create incidents and update them by ID. You set up the transmitted values by yourself.

All scripts listed in the example below will create the issue in Jira. Default connection for all example is Zabbix.


In the above screenshot, the [AlertCatcher] Connection and [AlertCatcher] Alert ID fields have been added, displaying the connection, rule and incident ID received from a third-party system. These fields are optional for adding to the issue screen, but we recommend that you add them. In the future, this will simplify the process of creating reports on requests.

JSON POST request

To create an incident, send a POST request to the endpoint specified on the connection settings page.

Example of request

This request will create an incident on behalf of the user specified in the connection settings.  


curl --request POST \
  --url https://<my-jira.com>/rest/catcher/1.0/alerts/zabbix/ \
  --header 'content-type: application/json' \
  --header 'x-api-key: <your api-key>' \
  --data '{
    "id": "123-888",
    "rule": "Redis: Service is down",
    "params" : {
        "Host": "10.100.0.5"
    }
}'


Request headers

JSON parameters of the request body

(warning) - mandatory fields

Form data POST request

You can also use form-urlencoded (for example, if you send a request with Paessler PRTG).

Example of request

This request will create an incident on behalf of the user specified in the connection settings.  


curl --request POST \
  --url https://<my-jira.com>/rest/catcher/1.0/alerts/zabbix \
  --header 'content-type: application/x-www-form-urlencoded' \
  --header 'x-api-key: <your api token>' \
  --data id=123-888 \
  --data 'rule=Redis: Service is down' \
  --data Host=10.100.0.5


Request body parameters

(warning) - mandatory fields

Other parameters you pass as key value in the request body. If there is a key with the field name on the issue creation screen, the value will be assigned to that field. The other values will be added to the table in Description.(warning)

Request headers

Transfer of parameters via GET request

You can also create an incident using the GET request. Although it is not correct to use this method to create new entities, Alert Catcher provides this feature as well. To activate this feature, go to the Security tab and change the Create via incidents GET requests and Anonymous requests values in Enabled.

Example of request

This request will create an incident on behalf of the user specified in the connection settings.  (In this example, we're not replacing spaces by %20, for clarity)
All you have to do is follow the link below to create an incident.


https://<my-jira.com>/rest/catcher/1.0/alerts/zabbix?id=123-888&rule=Redis: Service is down&host=10.100.0.5


Request URL Parameters

(warning) - mandatory fields

The rest of the parameters you transmit as a key value. If there is a key with the field name on the issue creation screen, the value will be assigned to that field. The other values will be added to the table in Description.(warning)

Restrictions

On the Security tab, you can change access and the way incidents are created: 

Update of incident

In this example, the incident with an identifier specified instead of <your-id> will be updated.


curl --request PUT \
  --url https://<your jira>/rest/catcher/1.0/alerts/zabbix/<your-id> \
  --header 'content-type: application/json' \
  --header 'x-api-key: <your api token>' \
  --data '{
    "id":  <your-id>,
    "rule": "Redis: Service is down",
    "params" : {
        "Host": "10.100.0.5",
        "redis.info.used.memory": "2002944"
    }
}'