Today we are going to discuss all about Django Rest Framework and it’s uses in this article. There will be everything you need to know about the Django rest framework. So let’s get started
What is A REST API :
A rest framework is well known as a RESTful APIs, it is basically a successful approach to connect any resource to work with many applications. Let me describe that – I am meaning that Rest Api is used to transfer data through the internet between various systems, in case of systems it can be web Applications, Android Applications, Desktop Applications and others. Rest Api stands for Application Programming Interface. And RESTful api or REST API represents the REpresentational State Transfer.
How a REST API works:
REST API is basically such an interface from where one can communicate with a web server without directly interacting with it. If you do not know anything about APIs then it is new to you.
Well, we use this interface to transfer any data stored in a web server to any of our known interfaces. Known interfaces can be your website or your android app or desktop app it can be anything. Suppose, you are a developer and making a weather forecasting app or website, so you are not able to see every state’s weather, so what is the solution then ?
Well, there the APIs come in the picture. You can easily make this app or website using an api, you only need to go to any of the weather forecasting websites there you have to request an api form the owner of the website and after he approves you to use their api you will be able to make your interface easily through the api.
Api libraries in Programming Languages:
An API used only for data transfer, as I said before. When you are making an app or website there will be prebuilt libraries for sending and receiving requests like if you are using PHP then there are libraries called Yii2 Httpclient, Guzzle if you are using python then there is a pre-installed library called requests to send requests to other websites. And in android there is a library called Volley, this is not a prebuilt library but you can use that , this is a very powerful library.
What an API does ?:
When you call an api, generally an api can be called by it’s url, the api gets activated, it receives the request and processes as it’s algorithm set by the developer and generates a CRUD( Described below) and sends it to the Database then returns the returned data as response. In the response you will get the data against the request you sent. Basically you are sending a request to a server and telling the server to send a query to the database and then return the response. This is how an api works.
What is CRUD:
I’ve used the word CRUD in the above paragraph but didn’t describe the meaning. The CRUD represents Create, Read, Update, Delete. Every data is being stored on a database, this database can be your hard drive, this data can be a sql database, this database can be a no-sql database. If the data will be stored online then everyone will choose the sql and no-sql because this is the most reliable and heavy used platform to store the data. SQL represents Structured Query Language.
And the NO-SQL represents a NO–Structured Query Language. These databases have their own protocols. These databases have mainly four operating methods that is the CRUD means create, read, update, and delete. This is what CRUD means.
Difference between API and REST API:
Now this is the question in your mind: what is the difference between these two APIs, right ?
Well, and API is a set of rules or a protocol from which data can be accessed on multiple systems. And the REST API is such a protocol from where, two networked devices can communicate to each other. And share data among them.
Django Rest Framework:
Now here you know what rest api is and what is api. Now django rest api or the package name is djangorestframework and can be installed using pip install djangorestframework command. This command will simply install the library onto your system. If your python is not installed, click here: https://www.technicalsayan.in/link-frontend-website-with-django-backend/
And to know more details about django rest framework go to the link below: https://www.django-rest-framework.org/
So in this article we have discussed what is an api and what is the role of an api in the internet then we discussed how an api works. Then we discussed how people loved it and how it’s usage was gradually increased. Then we discussed how every programming language implemented it’s own library for api integration. Then we talked about the backend working of an api. After that we understand the CRUD functionality. After that we discussed the difference between API and REST APIs. Then finally we discussed the django rest framework and it’s installation.
That’s it for today, comment below if you liked the article. And also if you have any suggestions. Thank You !