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.
This feature is available starting with SIL Engine™ 2.5.5.
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
- Go to Administration > Add-ons and select Redirect Page Configuration in the CPRIME TOOLS section.
- SIL Editor, where you can create the script to perform the redirect, appears.
- The script works by returning a string value, that represents a context-relative URL.
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.
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¶m2=value2. These parameters are passed into the SIL™ Script via the argv variable, and are accessible using the indexing operator. (e.g. argv["param1"] )
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 that you must URL-encode the text.