DJANGO REST FRAMEWORK

DJANGO REST FRAMEWORK


WHAT IS DRF?


Django REST framework (DRF) is a powerful and flexible toolkit for building Web APIs. It is a Python library for building web application programming interfaces (APIs). Django REST framework is a micro-framework library built on top of Django. It basically removes the complexities that exist when trying to use Django to write REST APIs. With DRF, one can write REST APIs with just a few lines of code. The Django REST will return only a JSON response which canbe accessed by anybody who wishes to use it. All they have to do is write code that will consume the API (that is, de-serialize the JSON response).

IF DJANGO WHY DJANGO REST?


DRF is convenient in many ways and offers a number of advantages, such as excellent usability due to web-browsable API, authentication policies that include packages for OAuth1 andOAuth2, serialization that supports both ORM and non-ORM datasources. It is easy to manage code and entire the project. If you wishto implement any changes on the backend code, you won’t have tostart making changes on the frontend. It clearly separates the job ofmanaging the database and every other server-side function fromthe presentation to the client.

WHAT IS an API?


An API is a set of definitions and protocols for building andintegrating application software. It’s sometimes referred to as a contract between an information provider and an information user—establishing the content required from the consumer (the call)and the content required by the producer (the response).APIs allow different software applications to communicate with each other,enabling developers to create new applications by integrating existing ones.

ARE APIs AND REST APIs SAME?


REST, or Representational State Transfer, is a style of software architecture that defines a set of constraints to be used when creatingweb services. A RESTful API is an API that adheres to these constraints. RESTful APIs use HTTP requests to GET, POST, PUT,and DELETE data. They are designed to be stateless, meaning thateach request contains all the information necessary to complete it. RESTful APIs are widely used because they are simple, flexible, and scalable.

WHAT IS JSON?


JSON stands for JavaScript Object Notation. It is a light-weight format for storing and transporting data. JSON is often used when data is sent from a server to a web page. It is "self-describing" and easy to understand. It is often used for serializing structured data and exchanging it over a network, typically between a server andweb applications. Since it is easy to understand this makes it awidely used format.

SERIALIZERS AND SERIALIZATION


Serializers are responsible for converting complex data such asquerysets to native python datatypes that can easily be rendered intoJSON or XML or other types that can be understandable byFrontend. They are also responsible for deserialization which means it allows parsed data to be converted back into complex types, after first validating the incoming data. DRF has the best-known serializers.

Thankyou for reading this article!

For more visit Core Django REST API Guide.

Faisal Nazir

This was really helpful because I am working on the project that needs DRF

To view or add a comment, sign in

Others also viewed

Explore content categories