Integrating SAP Build Apps with an API

Objectives
After completing this lesson, you will be able to:

After completing this lesson, you will be able to:

  • Make an HTTP request with an API URL
  • Set up the API data resource
  • Test the API call

Introduction

Up to this point, you’ve laid out your UI, and built the underlying logic to power the workflow. Now, we need to connect it to the data that will display a result on the screen after the barcode is scanned. The data we need for the barcode scanner app is stored in a modern database in the cloud that can be retrieved via an Application Programming Interface (API).

APIs are the foundation of how many modern applications are built because they are separate from the apps using them, and actually allow many different applications to make use of the same centralized data resources at the same time.

APIs can be accessed using URLs, which fetch the information we need in our app.

Making an HTTP Request with an API URL

Now we need to integrate with the API for the Barcode Scanner App, to make a connection to the OpenFoodFacts database. OpenFoodFacts has a specific URL to read data for a product, which we’ll use in this lesson. To make the app work, we need to make an HTTP request with the scanned barcode to this API URL.

An HTTP request is a message sent from a client (like a web browser or a mobile app) to a server, asking for some information or action. For example, when you type a web address (URL) into your browser's address bar and hit "enter," your browser sends an HTTP request to the server that hosts the website, asking for the web page associated with that URL. The server then responds with an HTTP response, which contains the information (in this case, the web page) that your browser requested.

HTTP requests can also be used to send data from a client to a server, for example when you fill out a form on a website and click "submit." In this case, the HTTP request contains the data you entered in the form, and the server can use this data to perform some action, like saving it to a database or sending an email.

Set Up the API Data Resource

Follow Along Step-By-Step to Create the Data Resource

Test the API Call

Follow Along Step-By-Step to Create the Data Resource

In SAP AppGyver, we will integrate with the API of OpenFoodFacts by creating a data resource. Data resources serve as connectors between data sources, such as APIs, and the application.

Log in to track your progress & complete quizzes