WHAT ARE APIs
API, or application programming interface, are
rules that allow different applications to communicate with each other. It acts
as an intermediary layer that processes data transfers between systems, letting
companies open their application data and functionality to external third-party
developers, business partners, and internal departments within their companies.
In a
Layman explanation. Let’s say
I am a developer A, I developed a website and a developer B somewhere wanted to
develop his website with some functionalities and information available in my
website, I can either give him my source code or access to my database. But
both of this ways are not exactly safe as such, the most suitable way for me is
to develop APIs on my website, as such I can share him endpoints to those APIs that
I made on my website. And In his end, he will be able to communicate with my
website and get access to authorized information, functionalities from my
website without having to access my source code or Database.
Explanation
of API to a five Year Old. Assume
you have a toy box with your toys inside. An API is like a helper that help and
make it easier for you to get toys from the toy box, you can ask the helper to
get you a specific toy and the helper will reach into the box and get it for
you.
Now imagine your friend want to play with your
toys, you can still ask the helper to reach into the toy box and get the same
toys for your friends that you have approved (authorized).
That’s what APIs does for websites and apps, it
make them share information with each other just like you and your friend sharing
toys.
HOW
EXACTLY DOES API WORKS
The working principle of an API is commonly
expressed through the request-response communication between a client and a
server. The client is any front-end application that a user interacts with. The
server is in charge of backend logic and database operations. In this scenario,
an API works as a middle layer between the client and the server, making it
possible to send data requests and responses.
BUILDING AN API WITH DJANGO REST
FRAMEWORK
Many frame works allows for building APIs for your web applications, but Django REST framework is popular, flexible and convenient in many ways and offers advantages such as:
1. BUILT
ONTOP OF DJANGO: if you are already
familiar with Django then using Django REST framework is easier as it leverage
Django’s ORM, authentication and other components.
2. Well
documented and widely used: Django REST framework is well-documented and has a
large community making it easier to find resources and support for building
your API.
3. Feature
Rich: Django REST framework provide a lot of feature and out-of-the-box
features such as serialization, request parsing, query parameter, pagination,
and more which can save lots of times and efforts in building APIs
4. Customizable:
The library is highly customizable, allowing you to override its behavior to
fit the specific requirements of your API
Want to get started with Django
REST framework ??? drop some comments,
and I’ll drop it soon
No comments:
Post a Comment