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:
Get the files from the Znuny source code on Github:
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.
Click on the “Add Web Service” button and follow the obvious steps for importing GenericTicketConnectorREST.yml file you downloaded in the previous step.
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.
What is worth mentioning are the following controls:
- 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.
- the access button for the web service debugger (2). Behind the button, all the details about the performed web service activity can be found.
- 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:
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>