How to connect OTRS with Redmine
Robert Ullrich26. May 2017 | ConsultingUse cases
The practical examples presented in our technical blog (blog.otrs.com) and now in the expert category in our FAQ blog section serve as a source of ideas and documentation to show what is theoretically possible with OTRS in concrete scenarios or sometimes even for more exotic configurations. All configurations presented here were developed under laboratory conditions as a proof of concept.
We can only guarantee testing and implementation of these concepts to be error-free and productive if implemented in a workshop with one of our OTRS consultants. Without this, the responsibility lies with the customer himself. Please note that configurations from older OTRS versions may not work in the newer ones.
With the OTRS Business Solution™ 5s, you have the possibility to connect OTRS with Redmine. The following article will explain how to configure the RedmineConnector to establish a connection between OTRS and Redmine.
To complete this Howto, you need a running OTRS & Redmine. Furthermore, you need to activate the REST API in Redmine first. Go to “Administration” – “Settings” – “API” and enable the check boxes and click on “save”.
OTRS Requirements for this HowTo:
The following OTRS framework is required:
You need the following Freely selectable Features of the OTRS Business Solution™ 5s :
(Adds new invoker for TicketCreate and TicketUpdate in the GenericInterface.)
(Contains additional functionalities to add conditions to events of invokers.)
Third Party Software
You need this third party software:
- DynamicField “RedmineID” of type „TEXT“
- DynamicField “RedmineIDJSON” of type “TEXT”
- another DynamicField “RedmineStatus” of type “TEXT”
Configuring the “RedmineConnector”
When you’re done with the pre-requirements, you have to create a new web service within OTRS. Afterward, you can set up the needed requester invokers.
The name of the new web service could be “RedmineConnector”:
Configuring the Invoker “CreateIssue”
Now we’re ready to start the configuration of our Invokers. The first Invoker is “CreateIssue”. Select all the needed data for your outgoing requests and use “XSLT” as mapping for your outgoing and incoming response data.
For the incoming response data, we’ve to use the two dynamic fields, which we created before.
Now we can configure our outgoing XSLT-mapping. If you need a working XSLT-mapping, you can use the following example:
You also need an XSLT-mapping for the incoming response data, because we need to store the Redmine Issue ID in two ways:
The Redmine Issue ID is stored in the dynamic field “RedmineID” and is afterward shown in the OTRS TicketZoom.
For updating Issues in Redmine we need to store the IssueID + the ending “.json” in the second dynamic field “RedmineIDJSON”. With the <xsl:value-of> element we’re modifying the response value:
<xsl:value-of select=”concat(//issue/id, ‘.json’)”/>
Last point for this invoker is the used “Event trigger”. Just select one and you’re done with the first Invoker.
Configuring the Invoker “UpdateIssue”
The next invoker is “UpdateIssue”. Select all the needed data for your outgoing requests (please don’t forget the dynamic field “RedmineIDJSON”) and use “XSLT” as a mapping for your outgoing data.
As outgoing XSLT-mapping you can use my example:
A mapping for the incoming response data is not necessary, but maybe a good idea. ;-)
The last point for this invoker is the used “Event trigger”. Just select one and you’re done with the second Invoker.
Configuring the Invoker “GetIssue”
The next invoker is “GetIssue”. The only field we need is the dynamic field “RedmineIDJSON”, because we want to receive the latest data from Redmine.
As outgoing XSLT-mapping you can use my example:
We need a mapping for the incoming response data because we want to show some values in OTRS. In my example I want to see the latest Redmine Issue state in OTRS:
The last point for this invoker is the used “Event trigger”. Just select one and you’re done with the last Invoker of this Howto.
Configuring the “Network Transport”
It’s necessary to configure the network transport because we’ve to use the right requests commands towards Redmine. But it’s quite easy as you can see:
It’s important to use “BasicAuth” as an authentication module. Please use a valid Redmine user for authentication!
Afterward just click on “Save and finish”.
Testing the “RedmineConnector”
Finally, we can do some tests. Just create or take an already existing ticket and trigger the “CreateIssue” Invoker.
As result you should see something similar in the OTRS Debugger:
In Redmine you’ll now see this Incident:
If we now trigger the Invoker “UpdateIssue” we receive an “error”:
As a result, the title changed from “A bug was found” to “A bug was found [ Updated in OTRS ]“. This is also visible in the Redmine History:
And the last the Invoker “GetIssue”:
We should now see the Redmine Issue state in OTRS.
The invoker “GetIssue” can be triggered regularly. For example with the freely selectable OTRS Business Solution™ feature “Advanced GenericAgent”. This feature allows relative time stamps for date/datetime dynamic fields.
More information about the Redmine API
You can also use other resources which are provided by the Redmine API.
Please go to the following website, if you need more information: http://www.redmine.org/projects/redmine/wiki/Rest_api