How to extend Automation for Jira with REST API calls

Still need help?

The Atlassian Community is here for you.

Ask the community

 

Summary

Not all of Jira REST API methods are available on Automation for Jira as actions - but we have the Send web request, that can be used to call REST APIs!

We'll use Jira as the destination, but any tool that accepts basic authentication is compatible too.

Solution

In this example, we'll create a web link for a Jira issue.

  1. On a terminal type a command like this:

    echo -n username:password | base64

    Take note of the command's result - it will be used in the Authorization header in step 3b.

  2. Create your rule and add the Send web request action.
  3. Let's configure it now!
    1. First, add the API URL:

      http://myjira/rest/api/2/issue/{{issue.key}}/remotelink

      (info)Note: in this case, we've used the smart value {{issue.key}} to add the issue key dynamically

    2. On the Headers field, add the name as Authorization and the value as Basic <key_from_above>
      (info)Note: make sure to use capital A and B
    3. Select the method as POST
    4. Set the webhook body as Custom data
    5. Set the custom data as the POST payload:
      {
          "globalId": "http://myurl.com",
          "object": {
              "url": "http://myurl.com",
              "title": "My fancy KB"
          }
      }
      

      The action will look something like this:

  4. Publish and test!


For more details on Jira's REST APIs: https://developer.atlassian.com/server/jira/platform/rest-apis/

More about Smart Values at https://support.atlassian.com/jira-software-cloud/docs/what-are-smart-values/



Last modified on Sep 4, 2020

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.