How to connect OTRS with Redmine

Robert Ullrich26. May 2017 | ConsultingUse cases

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”.

Redmine Setup

OTRS Requirements for this HowTo:

OTRS Framework

The following OTRS framework is required:

  • 5.0.x

OTRS Packages

You need the following Freely selectable Features of the OTRS Business Solution™ 5s :

  • OTRSGenericInterfaceInvokerTicket
(Adds new invoker for TicketCreate and TicketUpdate in the GenericInterface.)
  • OTRSGenericInterfaceInvokerEventFilter
(Contains additional functionalities to add conditions to events of invokers.)

Third Party Software

You need this third party software:

  • XML::Simple
  • XML::LibXML
  • XML::LibXSLT

DynamicFields

  • 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”:

General Setup of the RedmineConnector

General settings of the 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.

General Configuration of Invoker CreateIssue RedmineConnector

For the incoming response data, we’ve to use the two dynamic fields, which we created before.

Response Configuration CreateIssue RedmineConnector

Now we can configure our outgoing XSLT-mapping. If you need a working XSLT-mapping, you can use the following example:

XSLT-Mapping CreateIssue RedmineConnector

You also need an XSLT-mapping for the incoming response data, because we need to store the Redmine Issue ID in two ways:

CreateIssue Incoming Mapping RedmineConnector

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.

General invoker configuration UpdateIssueUpdateIssue ResponseData configuration RedmineConnector

As outgoing XSLT-mapping you can use my example:

XSLT-Mapping UpdateIssue RedmineConnector

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.

GetIssue Invoker configuration RedmineConnectorGetIssue Invoker configuration RedmineConnector

As outgoing XSLT-mapping you can use my example:

GetIssue Outbound mapping RedmineConnector

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:

GetIssue Inbound mapping RedmineConnector

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:

RedmineConnector Transport Configuration

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:

Debugger CreateIssue RedmineConnectorDebugger CreateIssue RedmineConnector

In Redmine you’ll now see this Incident:

Created Issue in Redmine

If we now trigger the Invoker “UpdateIssue” we receive an “error”:

Debugger UpdateIssue RedmineConnectorThis error is okay because OTRS only tells us that Redmine didn’t send an answer with a body.

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:

UpdateIssue Redmine RedmineConnector

And the last the Invoker “GetIssue”:

Debbuger GetIssue RedmineConnectorDebugger GetIssue RedmineConnector

We should now see the Redmine Issue state in OTRS.

GetIssue TicketZoom

Further thoughts

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

Your email address will not be published. Required fields are marked *

This site uses cookies. By continuing to use the site, you agree to the use of cookies. More information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.

Close