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. OpenFoodFactshas provided the following URL to read data for a product, which we’ll use in this lesson:https://world.openfoodfacts.org/api/v0/product/[barcode].json
To make the app work, we need to make an HTTP request with the scanned barcode to this API URL.