Web Service vs. API

Shawn Beasley07. May 2019 | Miscellaneous

Disclaimer:

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.

OTRS, as a glue-ware, offers you the flexibility to maintain service-relevant information anywhere. Retrieval of the information, and providing service request-related data to third parties, is simple. A web service, known as the Generic Interface, has been the answer to this since its introduction in OTRS 3.1. The web service provides access via HTTP by means of SOAP or REST to the internal OTRS API. The OTRS API is written in Perl, and by using the web service operations, standardized communication is possible. It’s not necessary to understand how the Perl API works in order to use internal functions of OTRS: Instead, operations are provided which can be made available to external systems or used to request information from these systems.

Learn how our new REST API can make simple integrations faster than ever.

The major difference is that our API is now forward-facing, as opposed to having to access the Perl API via REST Operations. The middle man has been cut out. There are advantages and drawbacks. We will focus on the advantages, which include:

  • Speed of deployment
  • Zero configuration
  • Standardized documentation
  • High flexibility
  • Increased security

The external interface’s front-facing RESTful API is available out-of-the-box with OTRS 7. The Generic Interface needs no configuration, as was needed in the past, because the endpoints and network transport are already defined. Perl is still under the hood, but instead of using special Perl Operations (limited functionality) provided the by Generic Interface, each endpoint is pre-defined (eg., Facebook, Google, etc). The documentation for the endpoints is available online and updated as new versions are built. The API documentation conforms to today’s API documentation standards in terms of how it is designed, delivered and easy-to-consume with examples and response codes for quick reference. You now have more flexibility than ever for accessing information which was not previously available with Generic Interface operations like customer user profile (/api/customer/account/personal-preferences information) and form data requirements (/api/frontend/external/form/ticket).

A simple ticket create can now be performed with very little effort. Authentication is sent in the header (make sure you generate a token /api/customer/auth/login), or it can be alternatively stored in a cookie. A payload like this is enough to create a ticket.

https://otrs.example.com/api/customer/ticket

Method POST

jSON Body
{
  “Title”:”test”,
  “Body”:”test”,
  “QueueID”:”1″,
  “State”:”open”,
  “PriorityID”:”1″,
  “SenderType”:”customer”,
  “HistoryType”:”Webrequset”
}

I look forward to hearing about your use cases.

Warm Wishes,

///shawn

“Man invented language to satisfy his deep need to complain.”

#15
Shawn Beasley at 31.01.2020, 14:03

This is unfortunately not a channel of support. If you need support go to a user forum or contact support@otrs.com Good luck.

#14
anthony attia at 31.01.2020, 04:21

Try to call the endpoint /api/customer/auth/login with following data: { "IsInteractive" : "1", "Password" : "******", "Username" : "anthony.attia.ext@opt.nc" } but response returns 401 :( doesnt work

#13
anthony at 31.01.2020, 01:49

Hi, I want to integrate OTRS ticket to my project and display them in component Angular, that's why I want to use the generic interface in REST API, but I dont know how to generate token.. please describe the steps to do this. It will be very helpful for me.

#12
Shawn Beasley at 13.12.2019, 13:38

Try the generic interface, the API is more specific to front-end development. Here you can do everything much more simply with the TicketCreate and TicketUpdate Operations.

#11
Peter at 12.12.2019, 11:02

Hey Shawn, I'm playing around with this new customer API on OTRS7, as a possible way to create webforms for customers to use. I can create a token, create a ticket, add an article to that ticket but I've not succeeded in setting a dynamic field value... Currently for creating an article, this is the json we use. { "SenderType": "customer", "HistoryType": "WebRequestCustomer", "State" : "open", "Subject": "Test username API", "Body": "Test usernameAPI", "DynamicField_test": "test" } An example of a working syntax would probably be enough to figure this out, but that's sorely lacking in the documentation as well.

#10
Shawn Beasley at 06.12.2019, 14:52

Yes, read this chapter. https://doc.otrs.com/doc/manual/itsm/stable/en/content/itsm-configuration-management/admin/processes-automation/web-services.html#

#9
Matteo at 06.12.2019, 14:17

I'm new to otrs. I don't understand this "The native REST API is currently only available in OTRS, and not in the ((OTRS)) Community Edition. The generic interface has REST operations that are available in the ((OTRS)) Community Edition.", what is the differences between "the native Rest API" and "the generic interface has REST operations"? I run ((OTRS)) Community Edition this ITSM module installed. How can I load CIs via REST api? Is there a configuration to enable the generic interface has REST?

#8
Shawn Beasley at 14.11.2019, 08:37

The native REST API is currently only available in OTRS, and not in the ((OTRS)) Community Edition. The generic interface has REST operations that are available in the ((OTRS)) Community Edition.

#7
harsha at 14.11.2019, 06:00

Is this rest API's compatible for OTRS 6??

#6
Shawn Beasley at 17.06.2019, 21:10

You should look at. https://doc.otrs.com/doc/api/otrs/stable/REST/#panel_api_customer_ticket__ticketid__article

#5
Rene at 17.06.2019, 15:22

Correct.

#4
Shawn Beasley at 14.06.2019, 12:53

You are talking about OTRS 7, correct?

#3
Rene at 20.05.2019, 15:17

Thanks for your answer, but I meant something different. OTRS accepting a request for TicketUpdate (e.g. a dynamic field). Like your example, but not creating a new ticket, but updating an existing one. I cannot find this case in the REST API documentation.

#2
Shawn Beasley at 20.05.2019, 08:43

Currently this API only accepts requests. If you need to send updates, then the OTRSTicketInvoker is the way to go. Please contact sales@otrs.com.

#1
Rene at 16.05.2019, 11:47

Hi Shawn, ist ist also possible to send a TicketUpdate (e.g. update a dynamic field) request using this REST API? I could not find it in the REST API documentation.

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