Oracle APEX – Let’s integrate with JIRA! Part 3

20 September 2019, Lech Cieślik

Jira is Atlassian’s software for error tracking and project management.  Users working with any APEX application often need to report an error regarding the application usage or data they work with. Instead of logging in to Jira, looking for a specified project, using a wizard that will allow to create a new request (name, type, description, request assignment, etc.), the user can easily use the a solution implemented fully in Oracle Apex, which we will introduce step by step in a new Oracle APEX article series – Let’s integrate with Jira! In the examples below we will use the Oracle Database 12c Enterprise Edition database and the Oracle SQL Developer Version 18.2. tool. 

This is the third and last article in the series. In the first article, we learned what OAuth authorization is and how the token exchange process works. In the second entry we used Java in the Oracle database to implement the digital signature using the SHA1-RSA encryption algorithm. Now it’s time learn how to create your first request in Jira from an Apex application. And this will be the goal of this article.

Jira API

Jira provides a REST API that allows integration of Jira with other applications. Thanks to the API, you can create, update, modify and delete data in Jira using standard HTTP methods such as GET, PUT, POST and DELETE.

We will use a POST HTTP request to create a Jira request. In the headers we will pass parameters such as the format and length of the sent message (Content-Type and Content-Length). However, the content of the Authorization header will be created according to the rules described in previous articles, example:

The content of the request will be saved in JSON format. According to the example below, a new high priority bug report will be added to the TPFAU project:

 Creating the Oracle Application Express form

In a series of articles, we described the so-called ‘OAuth Dance’ in detail, creating a signature using Java, and provided examples of using the Jira REST API. Based on all this information, in a few steps we can create a form in the Oracle APEX application that will allow us to create a request in Jira.

Business use case

We will use a specific business case for the solution presented. The user analyzes the report of the results of scientific experiments. During the analysis, he notices that the results are significantly different from the norm, which may be due to incorrect data. The user wants to create a bug request in Jira. The request should have the appropriate title, description, high priority and should be assigned to the person indicated by the user.

Example solution

  1. We create a link column with the Jira icon on the experiment report.
  2. We create the process for sending a request to generate a Request Token. In the request header, we define the address of the Oracle APEX form to create a ticket in Jira. Then, add the returned Request Token to the Authorization URL and define the redirection to the URL just created. The process should start after pressing the Jira icon.
  3. After confirming the identity on the authorization screen, the user will be redirected to the address defined in the request header from point 2.
  4. Next, we create a ‘Before Header’ process that retrieves the authorized Token and Verifier Request values ​​from the URL using the owa.num_cgi_vars library and writes their values ​​to APEX items.
  5. We create another ‘Before Header’ process that will send a request to generate an Access Token and save it to the APEX item.
  6. We create a form that allows you create a request in Jira with all attributes described in the business case.
  7. We add a process sending a request to create a bug in Jira using the API described in the first part of this article.

Summary

In a series of articles we have described the integration of the Oracle APEX application with the Jira tool. In the first article we presented in detail the operation of the “OAuth Dance” process which is based on the exchange of tokens. In the next entry we described the signature creation using Java. The last, third article contains an example of using the Jira API and is a summary of a whole series of entries showing how to create an Oracle APEX form to create a new Jira request for a specific business case.

Tagged with: , , , ,

Hire us!

Pretius is a software development company.
We create web applications using: Java, Oracle DB, Oracle Apex, AngularJS.
Contact us to talk about how we can help you with your software project!