In this post, I will be sharing how I created and added my first API to the RapidAPI Hub. It is called AnimaliAPI.
API stands for an Application Programming Interface, which is an interface or an intermediate between two software components or an application. It helps applications to interact with each other by taking requests and giving the responses. The main advantage of API is that whenever a software Developer writes code than he/she do not require to start writing the program from scratch and developer can use the API’s to proceed with their development.
Let's take an example that we want to create an application for a food recipe. It will probably require us to add the recipe of every food item in our application, so this might take quite a lot of time. So, let's say, there is an API of a food recipe and if we use that API instead of writing down the recipe ourselves, this will be much faster and easier. That is because, we just need to send a request to that API and it will give us the food recipe for us.
For some time, I have been consuming APIs for my programs and it was amazing to know how those APIs speed up in developing any program or application rather than coding everything from the scratch. So I wanted to try creating one simple API of my own which gives the scientific classification of animals. I wanted my API to return its scientific name and some other details when the request is sent using a name or its ID.
I did some searching and I decided that I will use Django Rest framework because I was quite familiar with Python and Django compared to other frameworks.
Django REST framework is a powerful and flexible toolkit for building Web APIs. Since we can not send Python objects over a network, and hence we need a mechanism to translate Django models in other formats like JSON, XML, and vice-versa. This process which is also called serialization, is made super easy with the Django REST Framework.
There are several ways to create an API using Django Rest such as using plain APIView, GenericAPIView and ViewSets. In my API, I've used just an APIView. I will write on how I created my Django Rest API in some other post.
After I completed creating my simple API, I decided to make it usable at any time for others or for myself, so I chose RapidAPI hub because I have been using some of their APIs myself. RapidAPI is the world's largest API hub, is used by over three million developers to find, test, and connect to thousands of APIs — all with a single API key and dashboard. The UI is easy to use and It gives us with the code to use directly on how to use the API from the hub.
The whole official document on how to start with RapidAPI can be found here. All the steps are easy to follow along starting from creating RapidAPI account, how to use the API from the hub, add our own API to the hub and anything that we need to know along with the video tutorials that is lot easier to follow.
Please don't forget to check out my API Here.
My GitHub link.