Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Table of Contents
minLevel1
maxLevel7

Webhook example

How to create a Jira issue

Field

Value

Action name

Any

(“Create Jira Issue” for example)

Worked with rules

Any

Action type

Webhook

Url

https://

mylovelyapp.atlassian.net

%instanceurl%/rest/api/3/issue

Token

You can construct and send basic auth headers. To do this you perform the following steps:

  1. Generate an API token for Jira using your Atlassian Account.

  2. Build a string of the form useremail:api_token (BASE64 encode the string) in terminal:

    • Linux/Unix/MacOS:
      echo -n user@example.com:api_token | base64

    • Windows 7 and later, using Microsoft Powershell:

      $Text = ‘user@example.com:api_token’
      $Bytes = [System.Text.Encoding]::UTF8.GetBytes($Text)
      $EncodedText = [Convert]::ToBase64String($Bytes)
      $EncodedText

  3. Supply an Authorization header with content Basic followed by the encoded string. For example, the string fred:fred encodes to ZnJlZDpmcmVk in base64, so you would make the request as follows:

Detailed information can be found here.

Headers

Code Block
languagejson
{
   "Accept":"application/json",
   "Content-Type":"application/json",
   "Authorization":"Basic 
sometoken
%token%"
}

Body for Jira

Code Block
languagejson
{
   "update":{
      
   },
   "fields":{
      "summary":"Sensitive content in {{issueKey}}",
      "issuetype":{
         "id":"10004"
      },
      "project":{
         "id":"10000"
      },
      "description":{
         "type":"doc",
         "version":1,
         "content":[
            {
               "type":"paragraph",
               "content":[
                  {
                     "text":"Search by template - {{templateName}}, found sensitive content in issue {{issueKey}} {{linkToIssue}}",
                     "type":"text"
                  }
               ]
            }
         ]
      }
   }
}

Body of Confluence

Code Block
languagejson
{
   "update":{
      
   },
   "fields":{
      "summary":"Sensitive content in {{contentName}}",
      "issuetype":{
         "id":"10004"
      },
      "project":{
         "id":"10000"
      },
      "description":{
         "type":"doc",
         "version":1,
         "content":[
            {
               "type":"paragraph",
               "content":[
                  {
                     "text":"Search by template - {{templateName}}, found sensitive content in {{linkToContent}}",
                     "type":"text"
                  }
               ]
            }
         ]
      }
   }
}

Example:

...

Created issue example (Jira):

...

Created issue example (Confluence):

...