KRedi - The Redirect Assistant

Looking for the documentation on the newest versions of SIL Engine and the Simple Issue Language for Jira 8 for Server/Data Center? Click here !

The Need for a Redirect Assistant

When integrating Jira with other external systems, it often happens that we need to provide access from those systems directly to Jira, while not being fully aware of the contents of the Jira instance. For this purpose, we designed KRedi, The Redirect Assistant.The idea behind KRedi is that we can build a custom URL, containing some parameters and pointing to our Jira instance. We then take these parameters and pass them into a SIL™ script that generates a valid Jira URL. This allows us to create a one-way dependency between the two systems, since the external system has no knowledge of the contents of our Jira instance.

Availability

This feature is available starting with SIL Engine™ 2.5.5.

Accessing KRedi

External access into our Jira instance will be provided as a simple URL: <base_url>/plugins/servlet/kredi

Accessing this URL triggers the script and redirects to whatever the script returns.

Writing the SIL™ Script

  1. Go to Administration > Add-ons and select Redirect Page Configuration in the CPRIME TOOLS section. 
  2. SIL Editor, where you can create the script to perform the redirect, appears.
  3. The script works by returning a string value, that represents a context-relative URL.
Example Redirect Script
 return "/browse/TEST";

4. The above script automatically takes care to append the context path to the generated URL. It will also work if you access Jira via mydomain.com or mydomain.com/myjira.

Passing Parameters

It's not really useful to not have any control from the external system, so in order to provide some guidance to the script, we can pass in some parameters in the URL: <base_url>/plugins/servlet/kredi?param1=value1&param2=value2. These parameters are passed into the SIL™ Script via the argv variable, and are accessible using the indexing operator. (e.g. argv["param1"] )

Example
// Let's assume that our external system generates URLs in the form of mydomain.com/plugins/servlet/kredi?externalId=1234
// and that we generate the URL based on that id
number extId = argv["externalId"];
string url;
// generate the url here based on the extId
return url;


Returning Errors

What if the script needs a certain parameter to do the redirect, but the user does not provide it? Where should we redirect to?

KRedi also provides an error page accessible at /plugins/servlet/kredierror that contains a generic error message.

If you would like to customize the error message or the error title, you can specify them in the URL using the customErrorMessage and/or customErrorTitle parameters. (e.g. /plugins/servlet/kredierror?customErrorTitle=My+Custom+Error+Title&customErrorMessage=This+is+a+generic+error+message.)

 

Note

Note that you must URL-encode the text.