What are REST APIs in SAP AppGyver?

Thanks for diving back into your transformation from Business User to Citizen Developer with SAP AppGyver. In the previous blog we explored how to leverage conditional logic within your applications. In this blog I will explain what REST APIs are in SAP AppGyver and why they are important.

By definition, an Application Programming Interface, or API, is a set of functions or procedures that allow for the creation of applications that access features or data of an operating system, application or other services. In simpler terms, an API is software that acts as a means of communication between 2 systems:

  1. The sender- the system that requires content or information. This system will request the information through the API using a call.
  2. The receiver: the system that will provide the information to the sender’s call. This system will provide the information through the API using a response.

Think of this as a phone that allows communication between 2 people. Before making a phone call you must know the phone number of the person that you are trying to call and input this number into the phone:

In the same way APIs need specific configurations so that it knows which 2 applications to connect. For example, imagine that you have a backend database and you need to transfer data between your Appgyver application and this database. An API will act as middleware between the database and your application in order to make this transfer possible. You must specify the endpoint URL of the backend that you are trying to reach in the API configuration.

Representational State Transfer or Rest is an architecture that can be implemented in an API. Let’s compare this architecture to making use of WhatsApp. Rest APIs must conform to the following constraints:

  1. A Uniform Interface: this completely separates the client from the server and allows them to interact with each other in a single language using HTTP. In our WhatsApp analogy, let’s think of this as using the application for different purposes. We can place calls and send messages in the same application.
  2. Client-Server Based: this dictates that the client will request resources from the server. Conversely, the server will provide the resources to the client. In our WhatsApp context, imagine you send a message to a friend asking what time they will be available for dinner. You (the client) need information from your friend (the server). Your friend will send a response with the relevant information.
  3. Stateless Operations: this means that the state needed to handle the request will not be stored in the server, but rather in the request itself. Compare this with the blue tick function in WhatsApp, when a recipient reads your message, the blue tick(the state of the message being read or unread) that appears on your message is only visible to you (the client), not the recipient (the server).
  4. RESTful Resource Caching: this means that a copy of frequently accessed data will be stored in the response path so that it can be retrieved at a quicker rate. Compare this to receiving a picture from a friend on WhatsApp. This picture will be stored on your WhatsApp application, so if you want to look at it again, you don’t have to ask your friend to resend it.
  5. Layered System: this means that the systems connected via the API are completely separated, so the client will not be able to determine whether it is connected directly to the server or if it connected using an intermediatory component.

As an AppGyver Citizen Developer, the main constraint to think about is the use of a uniform interface. The results of this constraint will allow you to perform 4 main operations in your data backend. These are:

  1. GET: this will allow you to retrieve data from the backend and leverage it within your AppGyver application.
  2. POST: this will allow you to create new entries in your backend application.
  3. PUT: this will allow you to update or change existing entries in your backend application.
  4. DELETE: this will allow you to remove specific entries from your backend application.

REST APIs are a light-weight, easy to use way of connecting your application to other resources. This makes them perfect for the Citizen Developer to get started with. Now that you understand what a REST API is and how it works, we will take a look at how configuring one would look in practice in the next blog.

Remember to check out the Citizen Developer Learning Journey for more enablement and earn your digital badge!