Access Znuny & OTRS API via REST

Learn in this article how to setup REST WebService APIs for OTRS / Znuny.

The article will guide you thru the configuration steps required to provide the REST API in Znuny / OTRS / OTOBO to access your tickets, articles and so on via the role of the service provider i.e. the system will be providing data upon request.

WebService are helpful in situations when you need to integrate the OTRS/Znuny with other systems, like CRM, Project Management tools Jira, Redmine, accounting e.g. QuickBooks, Sage, German’s DATEV, Lexware, instant messaging, and many more.

Configuration of REST API

For this tutorial, we will assume you have installed OTRS / Znuny already and that it is reachable over the network.

OTRS / Znuny provides a very nice and fully functional out-of-box example implementation/configuration of REST API which is allowing you to handle all common Ticket operations. All necessary files are located in the development folder of the Znuny source code tree. You will need the following two files:

GenericTicketConnectorREST.wsdl
GenericTicketConnectorREST.yml

Get the files from the Znuny source code on Github:

Figure 1: Download configuration files from GitHub

https://github.com/znuny/Znuny/tree/dev/development/webservices

Once you get the files it is the right time to start the configuration of the REST API and import.

Go to administration → web services.

Figure 2: Access to Web Service Management

Click on the “Add Web Service” button and follow the obvious steps for importing GenericTicketConnectorREST.yml file you downloaded in the previous step.

Figure 3: Import of REST API definition

After import of the web service configuration, you have REST API ready to be used. It appears in the web services list. By clicking on the WebService name you get to the web services configuration interface where you can fit the service to your needs.

You can customize all aspects of the web services, starting from the serving protocol, thru the routes up to the web service request specification. You can define rewriting rules for the translation of the OTRS variables to web request/response options.

The web service is imported with the name you have chosen (1). It is defined as HTTP::REST (2) service. There are predefined all necessary Ticket operations you might need (3). The web service route to operation mapping is accessible via the “Configuration” button next to the serving protocol (4). Customization of the HTTP requests and mapping of the variables <-> options is accessible by clicking on the particular operation.

For the purposes of this article, we will assume that the service configuration is fitting to our needs.

Webservice Controls

What is worth mentioning are the following controls:

  1. the newly imported web service is by default in DEBUG mode (1). This means that Znuny/OTRS is generating detailed information for each request to the web service. Do not forget to change the option once your web service is fine-tuned.
  2. the access button for the web service debugger (2). Behind the button, all the details about the performed web service activity can be found.
  3. webservice validity (3) allows you to disable a service without deleting its definition.

REST API routes

As we import the default configuration of the REST API web service introduce new routes which are created in the branch:

http://{{znunyHostName}}/otrs/nph-genericinterface.pl/Webservice/Ticket%20REST%20API

Related articles

Learn more about the default routes exposed in Znuny & OTRS REST API Routes.

Learn how to call OTRS & Znuny REST API using cURL in <link to cURL>

Do you need help with Znuny / OTRS?
We have lot of experiences with OTRS and Znuny and can help you with your issues. Get in touch with us and we will check if and how we can help you.

Leave a Comment

Do you need help with Znuny / OTRS?​

We have lot of experiences with OTRS and Znuny.
We can help you with your issues to solve them.

From giving you support up to implementing integrations to your existing systems.

Get in touch with us and we will check if and how we can help you.​

Get OTRS/Znuny/OTOBO Support
Step 1 of 2
To get a quick and efficient clearance of your needs, our experts will call you.
We communicate in English.
Maybe we can communicate in your native language too. So please let us know your native written and spoken language.

Your environment

We have different partners for different tasks and company sizes.
To assign you the right partner and thus the proper system engineers, we would like to ask you for more details about your environment.
The more details we get the quicker we can narrow down to the right persons.