The public REST APIs are often used to build the Jamstack web applications. Instead of looking up the correct API on the internet, we can visit RapidAPI Hub to find the API.
RapidAPI Hub is home to over 35000+ APIs of 45 different categories. If you don’t have an account, you would first have to sign up on the website to use the APIs. Afterward, a unique API Key will be generated for you. With this API key, you will have access to all APIs.
You can publish any public REST API on RapidAPI Hub. All you need is an account. In this piece, let’s look at what steps you need to take to publish an API under your name on RapidAPI Hub. So without any further ado, let’s jump in!
You can refer to the following steps to learn how to publish APIs on RapidAPI Hub:
Let’s look up a public API that we can publish on RapidAPI Hub. I have decided to go with JSONPlaceholder for this piece, but if you want to publish some other API, the steps will stay the same.
Create an account on RapidAPI Hub if you haven’t already. For this, click here and sign up either by providing a username, work email, and password or using your Google, GitHub, or Facebook account.
Once you have successfully signed up and logged in, click My APIs
on the navigation bar. It will take you to a page where you can add new APIs. Start by giving your API a name, a brief description, and choosing its category from the dropdown menu. Once you are done, click on the Add API
button.
It will take a second, and then the API you have just created will be under the My APIs
category from the sidebar.
Click on the Definition
under your API on the sidebar. You will see different fields here related to adding a long description, an image to represent your API, the API's website, and whether you want to add the terms and conditions. Fill in all the details and then click on Save.
Now click on Add a base URL
at the top for adding the API base URL. It will change the UI where you will have the' Configure' button under the Base URL
category. Go ahead and click on it. It will open a popup where you have an input box to add the base URL of your API.
Once you are done, click on Add some endpoints
at the top and click on Create REST Endpoint
.
Fill in all the required information like the endpoint's name, a brief description, the HTTP method used with the endpoint, and the endpoint itself. Once you are done, press Save
.
I have created more endpoints for fetching fake todos, comments, users, albums, and photos through the same steps.
Once you are done, click on the Make your API public
at the top and toggle the switch under the API Visibility
section to make the API public.
Now scroll to the top and click on the View in Hub
to see how your API looks like on RapidAPI Hub.
That’s pretty much. You can also monetize your APIs if you want. All you need to do is set up some price plans inside your API definition, and you are good to go.