How to use APIs from RapidAPI Hub?

Mon Oct 11 2021

3 min read

The APIs are a crucial part of web development. You heavily rely on them to get the required resource from the Internet. But it often becomes difficult to find an API that is perfect for your need. There are some repositories on the Internet, but they only have listed APIs and not provided a way to use them.

Loading component...

Using An API From RapidAPI

Let’s look at how you can get your desired API from RapidAPI Hub.

STEP #1

If you are new to the website, the first thing you would have to do is sign up on RapidAPI Hub. For this, you can click here, or you can open RapidAPI’s website and click on the Sign Up button at the top right corner.

You can either create a new account or sign up using your Google, GitHub, or Facebook account. I am going to use my GitHub account to sign up.

STEP #2

Once you are signed up, you will see a welcome message from RapidAPI Hub.

Here you have categories in the left sidebar, a search box at the top, and some recommended APIs. Let’s search for weather in the search box.

STEP #3

You will see a lot of different APIs as a search result. Let’s select the Open Weather Map API for this example. Now click on Subscribe to Test.

Once clicked, it will take you to another page. Here you would have to select a usage plan. Let’s choose the basic plan that is also free. After this, go back to the Endpoints page.

STEP #4

This page is divided into three sections: The leftmost part shows different endpoints, the middle one where you can set options related to the API, and the right part where you can see different code examples of how to use the API.

If you scroll down in the middle part, you will see an option called X-RapidAPI-Key. It is the API key that you would need to use any API from RapidAPI Hub. Make sure that it is secure.

Now select the endpoint you need from the left sidebar and the language you are using for your application from the right sidebar. Once selected, you will see the code you need to write to use the API. I am going to use the (JavaScript) fetch option.

Copy this code and paste it into your application, and that’s it. You have successfully integrated the Open Weather Map API from RapidAPI Hub Hub into your application.