<aside> 💡 In this chapter, we will understand how the Elrond API works and how you can use it to get useful information from the blockchain

</aside>

Understanding REST-APIs in general

When you go to a weather forecase website, it serves you with the latest weather data. This data is dynamic and constantly changing, hence it is not baked into the weather website. Instead, the weather website likely queries a so-called REST-API to get the freshest data. This following diagram should illustrate this:

graph TD
  User --> |Visit| A(Weather Website)
  A --> |Ask weather data| B(REST API)
  B --> |Ask raw weather data|C(Database)
  C --> |Return raw weather data|B
  B --> |Convert data|B
B --> |Return weather data|A
A --> |Prepare data for presentation|A
A --> |Show weather data|User

A REST-API is thus an interface that responds to requests. There are multiple types of REST-Requests (GET, POST, PUT, PATCH, DELETE, …), but we will only focus on the GET type in this tutorial.

What is a GET-Request?

As the name implies, a GET-Request gets you data. Nothing more, nothing less. Back to the weather example, let’s say the weather website wants to get the temperature in Ohio between 11-12 AM. A fitting request could look like this:

GET <https://api.weather-website.com/forecast/ohio?from=11&to=12>

Let’s break it down step-by-step:

Playing with the Elrond API

Now that we understood the basics, let’s move to https://api.elrond.com and have a look at the Elrond API!

Bildschirmfoto 2022-09-27 um 09.52.00.png

As we can see, we have plenty of paths (endpoints) to choose from. Every endpoint serves different data. Let’s see if we can extract something meaningful here!

Making our first request