API: definition in computer science and examples
API is the English acronym “ Application Programming Interface ”, that is, “Application Programming Interface”.
An “interface” is the way that two applications or services communicate with each other. They do so by exposing to the rest of the applications the set of services available in each one and how they should be accessed.
The series of these services is called an API . Therefore, these are used so that one application can interact with another.
Examples of how APIs work
Case 1: Reservation calendar for MiRestaurante
The restaurant has developed an application to make reservations. Now, they want to make it possible for users to make reservations from the Calendar.
So, they write an API that exposes a service for exchanging reservation-related data.
in natural language
My Agenda application can be programmed so that when it detects that the entry contains “eat-in MyRestaurant ” it automatically uses its API to reserve. So all I have to do is enter the entry in my calendar, and the apps take care of the rest via APIs.
In technical language
If you save an entry in the agenda that contains: “Eat in MyRestaurant”, access through a POST, to the URI: http://mirestaurante.com/api/reservar. Thus, it will send the identification, the number of diners, the date and time of the reservation.
Case 2: Connection between two Help Desks
The company MiEmpresa provides an IT support service to different clients and uses the ServiceTonic help desk. But, printer-related issues are escalated to a third-party provider, which uses its own help desk tool.
Both ServiceTonic and the provider’s tool have an API to manage incidents.
When a customer opens an issue related to, for example, printers at ServiceTonic, the app accesses the provider’s tool API and creates a ticket. When the provider completes the incident, their help desk tool accesses ServiceTonic via API, introduces the solution, and changes the status of the incident. Thus, each company can use its own help desk tool. All you have to do is connect both tools through their respective APIs.
In ServiceTonic, a business rule must be defined so that when creating an incident with the “Printer” category, it can be accessed through a POST to the URI http://provider.com/api/incidencias, sending the identification and data of the incidence.
And, in the provider’s help desk, it must be agreed that when the incident is solved, the URI http://client.myservicetonic.com/api/v1/tickets/id is accessed through a PUT. This will send the solution and the new state to the help desk.
API Connector Benefits
The benefits of having an API are mainly two:
- They allow the reuse of code, reducing the time and costs associated with the development of applications.
- They increase interoperability between applications , with the cost savings that this entails, since machines communicate information with each other faster than humans.
ServiceTonic and REST APIs
REST comes from “Representational State Transfer” and stands for “Representational State Transfer”.
The REST API is based on a client-server stateless protocol.
ServiceTonic includes a REST API to be able to:
- Access ServiceTonic from other applications.
- Access multiple and integrate multiple ServiceTonic installations.
- Open a bidirectional transfer of tickets and information between different services of your Service Desk, “out of the box” utilities.
Currently, the ServiceTonic API allows you to create and update tickets and/or contacts.
Contact ServiceTonic and find out how to connect your tool with ServiceTonic.