{"id":1597,"date":"2019-10-23T11:29:08","date_gmt":"2019-10-23T08:29:08","guid":{"rendered":"https:\/\/djangostars.com\/blog\/?p=1597"},"modified":"2025-09-12T13:10:41","modified_gmt":"2025-09-12T13:10:41","slug":"rest-apis-django-development","status":"publish","type":"post","link":"https:\/\/djangostars.com\/blog\/rest-apis-django-development\/","title":{"rendered":"How to Develop APIs with Django REST Framework [Step-by-Step Guide]"},"content":{"rendered":"<p>If you know the basics of the field you work in, you can master any technology, reach higher levels as a developer, and create better products.<\/p>\n<p>I believe this will be useful for all beginners looking to hire experts with a vast experience in <a href=\"https:\/\/djangostars.com\/services\/python-django-development\/\">Django web development services<\/a>, as REST APIs are essential for connecting backend and frontend parts in any application. Mastering this skill allows you to build all kinds of products.<\/p>\n<p>The experts of our company have repeatedly used Django REST Framework in their projects\u2014and we proactively track <a href=\"https:\/\/djangostars.com\/blog\/how-to-update-the-django-version-a-step-by-step-guide-to-hassle-free-upgrades\/\">Django updates<\/a> to keep those APIs secure, maintainable, and fast.<br \/>\n<div class=\"info_box_shortcode_holder\" style=\"background-image: url(https:\/\/djangostars.com\/blog\/wp-content\/uploads\/2023\/08\/Django-Development.png)\">\n    <div class=\"info_box_label\">\n    Services\n    <\/div>\n    <div class=\"info_box_logo\">\n    \n    <\/div>\n    \n    <div class=\"info_box_title font_size_\">\n   <span class=\"info_box_title_inner\">Expert Django Development Services for Your Business.&lt;br \/&gt;\n&lt;small&gt;Optimize Performance, Enhance Security, and Scale Effortlessly.&lt;\/small&gt;<\/span>\n    <\/div>\n    <div class=\"info_box_link\">\n        <a href=\"https:\/\/djangostars.com\/services\/python-django-development\/\" target=\"_blank\" >\n            <span>Discover Our Solutions<\/span>\n            <div class=\"button_animated\">\n                <svg width=\"24\" height=\"12\" viewBox=\"0 0 24 12\" fill=\"none\"\n                     xmlns=\"http:\/\/www.w3.org\/2000\/svg\">\n                    <path d=\"M23.725 5.33638C23.7248 5.3361 23.7245 5.33577 23.7242 5.33549L18.8256 0.460497C18.4586 0.0952939 17.865 0.096653 17.4997 0.463684C17.1345 0.830668 17.1359 1.42425 17.5028 1.7895L20.7918 5.06249H0.9375C0.419719 5.06249 0 5.48221 0 5.99999C0 6.51777 0.419719 6.93749 0.9375 6.93749H20.7917L17.5029 10.2105C17.1359 10.5757 17.1345 11.1693 17.4998 11.5363C17.865 11.9034 18.4587 11.9046 18.8256 11.5395L23.7242 6.66449C23.7245 6.66421 23.7248 6.66388 23.7251 6.6636C24.0923 6.29713 24.0911 5.70163 23.725 5.33638Z\"\n                          fill=\"#282828\"><\/path>\n                <\/svg>\n                <div class=\"shape\"><\/div>\n            <\/div>\n        <\/a>\n    <\/div>\n<\/div><\/p>\n<h2>Why Use the Django REST Framework for API Development?<\/h2>\n<p>Many frameworks allow you to easily build APIs for blog applications, but we will use only one \u2013 the Django REST framework (DRF). It\u2019s convenient in many ways and offers the following advantages:<\/p>\n<ul>\n<li>Its <a href=\"https:\/\/restframework.herokuapp.com\/\" rel=\"nofollow\">Web-browsable API<\/a> is a huge usability win for your developers.<\/li>\n<li><a href=\"https:\/\/www.django-rest-framework.org\/api-guide\/authentication\/\" rel=\"nofollow\">Authentication policies<\/a> include packages for <a href=\"https:\/\/www.django-rest-framework.org\/api-guide\/authentication\/#django-rest-framework-oauth\" rel=\"nofollow\">OAuth1<\/a> and <a href=\"https:\/\/www.django-rest-framework.org\/api-guide\/authentication\/#django-oauth-toolkit\" rel=\"nofollow\">OAuth2<\/a>.<\/li>\n<li><a href=\"https:\/\/www.django-rest-framework.org\/api-guide\/serializers\/\" rel=\"nofollow\">Serialization<\/a> supports both <a href=\"https:\/\/www.django-rest-framework.org\/api-guide\/serializers\/#modelserializer\" rel=\"nofollow\">ORM<\/a> and <a href=\"https:\/\/www.django-rest-framework.org\/api-guide\/serializers\/#serializers\" rel=\"nofollow\">non-ORM<\/a> data sources.<\/li>\n<li>It\u2019s customizable all the way down. Just use <a href=\"https:\/\/www.django-rest-framework.org\/api-guide\/views\/#function-based-views\" rel=\"nofollow\">regular function-based views<\/a> if you don&#8217;t need the <a href=\"https:\/\/www.django-rest-framework.org\/api-guide\/generic-views\/\" rel=\"nofollow\">more<\/a> <a href=\"https:\/\/www.django-rest-framework.org\/api-guide\/viewsets\/\" rel=\"nofollow\">powerful<\/a> <a href=\"https:\/\/www.django-rest-framework.org\/api-guide\/routers\/\" rel=\"nofollow\">features<\/a>.<\/li>\n<li>It has <a href=\"https:\/\/www.django-rest-framework.org\/\" rel=\"nofollow\">extensive documentation<\/a> and <a href=\"https:\/\/groups.google.com\/forum\/?fromgroups#!forum\/django-rest-framework\" rel=\"nofollow\">great community support<\/a>.<\/li>\n<li>It\u2019s used and trusted by internationally recognized companies including <a href=\"https:\/\/www.mozilla.org\/en-US\/about\/\">Mozilla<\/a>, <a href=\"https:\/\/www.redhat.com\/en\">Red Hat<\/a>, <a href=\"https:\/\/www.heroku.com\/\">Heroku<\/a>, and <a href=\"https:\/\/www.eventbrite.co.uk\/about\/\" rel=\"nofollow\">Eventbrite<\/a>.<\/li>\n<\/ul>\n<p>REST, which stands for &#8216;REpresentational State Transfer,&#8217; is one of the programming architectures that define how Django APIs work. The term &#8216;RESTful&#8217; is used for web services that adhere to REST constraints. In a nutshell, while DRF makes it easy to work with Django, RESTful APIs work according to REST. By the way, find out why we use Django.<\/p>\n<h2>Difference between Django and Django REST Framework<\/h2>\n<p>Despite the similarity in names, Django and Django REST frameworks serve different purposes.<\/p>\n<p>Django is a high-level Python web framework encouraging rapid development and clean, pragmatic design. It facilitates the creation of robust web applications with minimal code, providing tools to handle the site&#8217;s administrative tasks. Django&#8217;s primary goal is to ease the creation of complex, database-driven websites.<br \/>\n<div class=\"info_box_shortcode_holder\" style=\"background-image: url(https:\/\/djangostars.com\/blog\/wp-content\/uploads\/2023\/08\/Technology-Consulting.png)\">\n    <div class=\"info_box_label\">\n    Services\n    <\/div>\n    <div class=\"info_box_logo\">\n    \n    <\/div>\n    \n    <div class=\"info_box_title font_size_\">\n   <span class=\"info_box_title_inner\">Tech consultancy: Get advantage.&lt;br \/&gt;\n<\/span>\n    <\/div>\n    <div class=\"info_box_link\">\n        <a href=\"https:\/\/djangostars.com\/services\/software-consultancy\/\" target=\"_blank\" >\n            <span>Learn More<\/span>\n            <div class=\"button_animated\">\n                <svg width=\"24\" height=\"12\" viewBox=\"0 0 24 12\" fill=\"none\"\n                     xmlns=\"http:\/\/www.w3.org\/2000\/svg\">\n                    <path d=\"M23.725 5.33638C23.7248 5.3361 23.7245 5.33577 23.7242 5.33549L18.8256 0.460497C18.4586 0.0952939 17.865 0.096653 17.4997 0.463684C17.1345 0.830668 17.1359 1.42425 17.5028 1.7895L20.7918 5.06249H0.9375C0.419719 5.06249 0 5.48221 0 5.99999C0 6.51777 0.419719 6.93749 0.9375 6.93749H20.7917L17.5029 10.2105C17.1359 10.5757 17.1345 11.1693 17.4998 11.5363C17.865 11.9034 18.4587 11.9046 18.8256 11.5395L23.7242 6.66449C23.7245 6.66421 23.7248 6.66388 23.7251 6.6636C24.0923 6.29713 24.0911 5.70163 23.725 5.33638Z\"\n                          fill=\"#282828\"><\/path>\n                <\/svg>\n                <div class=\"shape\"><\/div>\n            <\/div>\n        <\/a>\n    <\/div>\n<\/div><br \/>\nFor its part, DRF is a powerful and flexible toolkit used to build Web APIs on top of Django. While Django deals with the overall web application, including both frontend and backend components, DRF is used to build RESTful APIs that allow interaction and communication between different software components. With DRF, it&#8217;s easier to design the CRUD operations and use a Django Server as a REST API. Django Rest framework leverages Django&#8217;s capabilities to facilitate the development of scalable, maintainable, and secure APIs. It adheres to Django&#8217;s principles like DRY (Don&#8217;t Repeat Yourself) and emphasizes reusability and modularity.<\/p>\n<p>In essence, DRF extends Django&#8217;s functionalities. When used together, these tools can significantly accelerate the development process, maintaining a balance between robustness and simplicity.<\/p>\n<h2>The Step-by-Step Guide To Your API in Django<\/h2>\n<p>In this<!--Django REST framework--> Django restful api tutorial, we\u2019ll go through all the stages of building an API in great detail. Please note that you will not find a more detailed Django REST framework tutorial even on w3schools.<\/p>\n<h3>Set up your development environment<\/h3>\n<p>First of all, you have to install<a href=\"https:\/\/github.com\/pyenv\/pyenv\/wiki#suggested-build-environment\" rel=\"nofollow\"> Python dependencies<\/a> for your OS. If you\u2019re using Windows, you can easily install Linux as your secondary OS using this <a href=\"https:\/\/ubuntu.com\/tutorials\/install-ubuntu-desktop#0\" rel=\"nofollow\">manual<\/a> or <a href=\"https:\/\/www.virtualbox.org\/wiki\/Downloads\" rel=\"nofollow\">VirtualBox<\/a>.<br \/>\nTo proceed, use <a href=\"https:\/\/github.com\/pyenv\/pyenv#installation\" rel=\"nofollow\">pyenv<\/a>, a simple yet effective Python management tool. It\u2019s our go-to helper. It allows us to change the global Python version, install multiple Python versions, set project-specific Python versions, and manage virtual Python environments.<\/p>\n<p>If you\u2019re using Mac OS or Linux, it should be easy to <a href=\"https:\/\/github.com\/pyenv\/pyenv#installation\" rel=\"nofollow\">install<\/a>:<\/p>\n<pre><code>$ git clone https:\/\/github.com\/pyenv\/pyenv.git ~\/.pyenv<\/code><\/pre>\n<p>Define the environment variable <code>PYENV_ROOT<\/code> to point to the path where pyenv repo is cloned. Then, add <code>$PYENV_ROOT\/bin<\/code> to your <code>$PATH<\/code> for access to the pyenv command-line utility.<\/p>\n<pre><code>$ echo 'export PYENV_ROOT=\"$HOME\/.pyenv\"' &gt;&gt; ~\/.bashrc\r\n$ echo 'export PATH=\"$PYENV_ROOT\/bin:$PATH\"' &gt;&gt; ~\/.bashrc<\/code><\/pre>\n<p>Add the pyenv unit to your shell to enable shims and autocompletion.<\/p>\n<pre><code>$ echo -e 'if command -v pyenv 1&gt;\/dev\/null 2&gt;&amp;1; then\\n\u00a0 eval \"$(pyenv init -)\"\\nfi' &gt;&gt; ~\/.bashrc<\/code><\/pre>\n<p>Restart your shell so the path changes take effect. Now, you can begin to use pyenv.<\/p>\n<pre><code>$ exec \"$SHELL\"<\/code><\/pre>\n<p>At this step of the Django API tutorial, install the latest stable version of Python. Now this&#8230;<\/p>\n<pre><code>$ pyenv install 3.7.4<\/code><\/pre>\n<p>\u2026 and create an environment for your project.<\/p>\n<pre><code>$ pyenv virtualenv 3.7.4 blog<\/code><\/pre>\n<h3>Create a Django Project<\/h3>\n<p>Now, we\u2019ll create a project folder and navigate to the newly created directory.<\/p>\n<pre><code>$ mkdir projects &amp;&amp; cd projects<\/code><\/pre>\n<p>The next step is to create a Django project. There are several ways to do it.<\/p>\n<p>Personally, I prefer to <a href=\"https:\/\/docs.djangoproject.com\/en\/2.2\/ref\/django-admin\/#startproject\" rel=\"nofollow\">start Django REST framework projects<\/a> from a template and use the <a href=\"https:\/\/github.com\/django-stars\/backend-skeleton\" rel=\"nofollow\">Django Stars backend skeleton<\/a> that has been implemented in our web development company. It\u2019s a great tool, since\u2026<\/p>\n<ul>\n<li>Django projects are formatted according to the Django Stars Code Style requirements,<\/li>\n<li>django-environ helps keep all configuration in the environment,<\/li>\n<li>psycopg2 is the default database driver,<\/li>\n<li>django-extensions\/ipython\/ipdb is used for debug purposes,<\/li>\n<li>pytest with pylava are provided for testing, and<\/li>\n<li>A redefined startapp command allows you to create apps according to Django Stars Code Style requirements.<\/li>\n<\/ul>\n<p>Here\u2019s the command that will help you start a project from a template:<\/p>\n<pre><code>$ curl https:\/\/be.skeletons.djangostars.com\/startproject | bash<\/code><\/pre>\n<p>At the start, you will be offered several Python versions to work with. Select the 3.7 version of Python.<br \/>\n<img decoding=\"async\" src=\"https:\/\/djangostars.com\/blog\/wp-content\/uploads\/2022\/09\/Django-Stars-Backend-Skeleton.png\" alt=\"Django Stars Backend Skeleton\" \/><br \/>\nFurther according to the Django REST tutorial, set the project name to django_blog.<\/p>\n<p>Since we\u2019re going to use the Django Rest Framework, we should select the 3rd option:<br \/>\n<img decoding=\"async\" src=\"https:\/\/djangostars.com\/blog\/wp-content\/uploads\/2022\/09\/Django-REST-API-Example-BE-Skeleton.png\" alt=\"Django-REST-API-Example-BE-Skeleton\" \/><br \/>\nIf you know you\u2019ll need Celery for your project, you can also choose the first option and press OK.<\/p>\n<p>Anyway, what we just did was create a project from a template. Let\u2019s now navigate to the project name directory:<\/p>\n<pre><code>$ cd django_blog<\/code><\/pre>\n<p>This is what our project\u2019s structure looks like:<br \/>\n<div class=\"oembed-gist\"><script src=\"https:\/\/gist.github.com\/olegkovalov\/cf0b48e9aa51c8a2dab9587a4b30f369.js?file=gistfile1.txt\"><\/script><noscript>View the code on <a href=\"https:\/\/gist.github.com\/olegkovalov\/cf0b48e9aa51c8a2dab9587a4b30f369\">Gist<\/a>.<\/noscript><\/div><\/p>\n<h3>Install packages with requirements<\/h3>\n<p>To run the project, we need to install some packages, which are defined in the <code>requirements\/dev.txt.<\/code><\/p>\n<p>Thus, we install packages with requirements for local development.<\/p>\n<p>Navigate to the API directory:<\/p>\n<pre><code>$ cd api<\/code><\/pre>\n<p>and install the dependencies.<\/p>\n<p>If you need to add any other Django packages, just add your package to the dev.txt file for local development, or to common.txt if you need it to be installed on the server.<\/p>\n<p>Next, we will have to add the Pillow package that isn\u2019t included by default in the package we installed. Open the<br \/>\n<code>requirements\/common.txt<\/code> file and add Pillow==6.1.0 to the end. Then run:<\/p>\n<pre><code>$ pip install -r requirements\/dev.txt<\/code><\/pre>\n<p>This is the file that contains a list of all the packages that will be installed.<\/p>\n<h3>Bootstrap the Database<\/h3>\n<p>Our project needs a database. Most Django developers prefer to use PostgresQL for all environments \u2013 i.e., the, development, staging and production systems. Some people use SQLite for local development and PostgreSQL in production. Django ORM allows you to deal with both databases. I strongly recommend that you keep your development station and production as similar as possible and use the same database.<\/p>\n<p>There are several ways to bootstrap a database:<\/p>\n<ul>\n<li>Using SQLite<\/li>\n<\/ul>\n<p>To make the database bootstrapping easier, we can use SQLite. It\u2019s an in-process library that implements a self-contained, serverless, zero-configuration, transactional SQL database engine.<\/p>\n<p>All you need to do is open the .env file and replace:<br \/>\n<div class=\"oembed-gist\"><script src=\"https:\/\/gist.github.com\/olegkovalov\/096f982a4b45839463e073cf471a0746.js?file=django_blog_db_url.env\"><\/script><noscript>View the code on <a href=\"https:\/\/gist.github.com\/olegkovalov\/096f982a4b45839463e073cf471a0746\">Gist<\/a>.<\/noscript><\/div><br \/>\nwith<br \/>\n<div class=\"oembed-gist\"><script src=\"https:\/\/gist.github.com\/olegkovalov\/7bb7a0745124107224dbb0ddec3d8b9b.js?file=django_blog_db_sqlite_url.env\"><\/script><noscript>View the code on <a href=\"https:\/\/gist.github.com\/olegkovalov\/7bb7a0745124107224dbb0ddec3d8b9b\">Gist<\/a>.<\/noscript><\/div><br \/>\nHere, we use the <a href=\"https:\/\/django-environ.readthedocs.io\/en\/latest\/\" rel=\"nofollow\">django-environ<\/a> package, which allows you to define the configuration depending on your environment. You can find out more about this approach through <a href=\"https:\/\/12factor.net\/\" rel=\"nofollow\">The Twelve Factor App<\/a>.<\/p>\n<ul>\n<li>Using PostgreSQL<\/li>\n<\/ul>\n<p>PostgreSQL is a powerful, open-source object-relational database system. It uses and extends the SQL language, and has many features that allow you to safely store and scale the most complicated data workloads. This system is a bit more complicated than SQLite, so you might want to learn more <a href=\"https:\/\/www.postgresql.org\/about\/\" rel=\"nofollow\">about<\/a> it.<br \/>\n<div class=\"info_box_shortcode_holder\" style=\"background-image: url(https:\/\/djangostars.com\/blog\/wp-content\/uploads\/2023\/08\/Bespoke-Software-Development.png)\">\n    <div class=\"info_box_label\">\n    Services\n    <\/div>\n    <div class=\"info_box_logo\">\n    \n    <\/div>\n    \n    <div class=\"info_box_title font_size_\">\n   <span class=\"info_box_title_inner\">Stuck at Any Development Stage?&lt;br \/&gt;\n<\/span>\n    <\/div>\n    <div class=\"info_box_link\">\n        <a href=\"https:\/\/djangostars.com\/get-in-touch\/\" target=\"_blank\" >\n            <span>Get a Consultation<\/span>\n            <div class=\"button_animated\">\n                <svg width=\"24\" height=\"12\" viewBox=\"0 0 24 12\" fill=\"none\"\n                     xmlns=\"http:\/\/www.w3.org\/2000\/svg\">\n                    <path d=\"M23.725 5.33638C23.7248 5.3361 23.7245 5.33577 23.7242 5.33549L18.8256 0.460497C18.4586 0.0952939 17.865 0.096653 17.4997 0.463684C17.1345 0.830668 17.1359 1.42425 17.5028 1.7895L20.7918 5.06249H0.9375C0.419719 5.06249 0 5.48221 0 5.99999C0 6.51777 0.419719 6.93749 0.9375 6.93749H20.7917L17.5029 10.2105C17.1359 10.5757 17.1345 11.1693 17.4998 11.5363C17.865 11.9034 18.4587 11.9046 18.8256 11.5395L23.7242 6.66449C23.7245 6.66421 23.7248 6.66388 23.7251 6.6636C24.0923 6.29713 24.0911 5.70163 23.725 5.33638Z\"\n                          fill=\"#282828\"><\/path>\n                <\/svg>\n                <div class=\"shape\"><\/div>\n            <\/div>\n        <\/a>\n    <\/div>\n<\/div><br \/>\nIt\u2019s much easier to install PostgreSQL with Docker \u2013 an open-source tool that automates the deployment of an application inside a software container. If you\u2019re not familiar with Docker yet, feel free to check out some <a href=\"https:\/\/docs.docker.com\/install\/\">instructions<\/a> on how to install it and work with <a href=\"https:\/\/docs.docker.com\/compose\/install\/\" rel=\"nofollow\">docker-compose<\/a>.<\/p>\n<p>Then just open a new tab and run:<\/p>\n<pre><code>$ docker-compose -f build\/docker-compose-dev.yml up<\/code><\/pre>\n<p>Next, we should apply initial migrations:<\/p>\n<pre><code>$ python manage.py migrate<\/code><\/pre>\n<p>This will apply all previously unapplied migrations to the database which comes with the Django installation.<br \/>\n<a href=\"https:\/\/github.com\/olegkovalov\/django_blog\/commit\/4f9b20bafc69fb686026d112592c549bd8b6e858\" rel=\"nofollow\">https:\/\/github.com\/olegkovalov\/django_blog\/commit\/4f9b20bafc69fb686026d112592c549bd8b6e858<\/a><\/p>\n<h3>Create a Blog Application<\/h3>\n<p>Next, according to the Python Django REST API tutorial, we\u2019ve already created a Django project, installed packages with requirements, and bootstrapped the database. Which means we can now finally create a blog application using the following command:<\/p>\n<pre><code>$ python manage.py startapp blog<\/code><\/pre>\n<p>By doing this, you\u2019ve also created a new directory. It will be available in <code>apps\/blog.<\/code><\/p>\n<p>Now, we should register our application in <code>\u2018INSTALLED_APPS\u2019<\/code>.<\/p>\n<p>Add \u2019blog\u2019 to your <code>\u2018INSTALLED_APPS\u2019<\/code> settings placed in <code>\u2018api\/django_blog\/settings\/django.py\u2019<\/code><br \/>\n<div class=\"oembed-gist\"><script src=\"https:\/\/gist.github.com\/olegkovalov\/7e18b7130baf3541cfea94a69bb2f986.js?file=settings_installed_apps.py\"><\/script><noscript>View the code on <a href=\"https:\/\/gist.github.com\/olegkovalov\/7e18b7130baf3541cfea94a69bb2f986\">Gist<\/a>.<\/noscript><\/div><\/p>\n<h2>Test-Driven Development (TDD) of APIs<\/h2>\n<p>As you may have already learned, test-driven development is an approach that focuses on writing tests before you start implementing the business logic of your application. Writing tests first requires you to really consider what do you want from the code. But apart from this, TDD has numerous other benefits:<\/p>\n<ol>\n<li>Fast feedback and detailed specification;<\/li>\n<li>Reduced time spent on reworking and time spent in the debugger;<\/li>\n<li>Maintainable, flexible, and easily extensible code;<\/li>\n<li>Shorter development time to market;<\/li>\n<li>Increased developer\u2019s productivity;<\/li>\n<li>SOLID code; and<\/li>\n<li>A clean interface.<\/li>\n<\/ol>\n<p>Also, TDD tells you whether your last change (or refactoring) <em>broke previously working code<\/em>. Moreover, it forces <em>radical simplification of the code<\/em> \u2013 you will only write code in response to the requirements of the tests. Also, you&#8217;re forced to write small classes focused on one thing only. Further on, it allows the design to <em>evolve and adapt<\/em> to your changing understanding of the problem.<\/p>\n<p>The resulting unit tests are simple and act as documentation for the code. Since TDD use cases are written as tests, other developers can view the tests as examples of how the code is supposed to work.<\/p>\n<p>Before we write tests for our API in Django, let\u2019s take a step back and look at HTTP and how it interacts with the DRF.<\/p>\n<p>The Hypertext Transfer Protocol (HTTP) is an application protocol for distributed, collaborative, hypermedia information systems. HTTP defines methods like GET, POST, PUT, DELETE, OPTIONS, and HEAD to indicate the desired action that should be performed on the resource you identify. These methods can be defined by the characteristics of safety and idempotency (you can find out more about this <a href=\"https:\/\/www.w3.org\/Protocols\/rfc2616\/rfc2616-sec9.html\" rel=\"nofollow\">here<\/a>). By agreement, Django REST APIs rely on these methods, so feel free to use the appropriate HTTP method for each type of action in your Django REST API project.<\/p>\n<p>Let\u2019s apply it to the resource \u2018post\u2019.<br \/>\n<div class=\"supsystic-table-loader spinner\"style=\"background-color:#000000\"><\/div><div id=\"supsystic-table-19_75654\" class=\"supsystic-tables-wrap\" style=\" background: url(); visibility: hidden; \" data-table-width-fixed=\"100%\" data-table-width-mobile=\"100%\" ><table id=\"supsystic-table-19\" data-border-spacing=\"\" class=\"supsystic-tableborder lightboxImgcell-border\" data-id=\"19\" data-view-id=\"19_75654\" data-title=\"resource \u2018post\u2019 Django REST Framework\" data-currency-format=\"$1,000.00\" data-percent-format=\"10.00%\" data-date-format=\"DD.MM.YYYY\" data-time-format=\"HH:mm\" data-features=\"[&quot;after_table_loaded_script&quot;]\" data-search-value=\"\" data-lightbox-img=\"\" data-head-rows-count=\"1\" data-pagination-length=\"50,100,All\" data-auto-index=\"off\" data-searching-settings=\"{&quot;columnSearchPosition&quot;:&quot;bottom&quot;,&quot;minChars&quot;:&quot;0&quot;}\" data-lang=\"default\" data-override=\"{&quot;emptyTable&quot;:&quot;&quot;,&quot;info&quot;:&quot;&quot;,&quot;infoEmpty&quot;:&quot;&quot;,&quot;infoFiltered&quot;:&quot;&quot;,&quot;lengthMenu&quot;:&quot;&quot;,&quot;search&quot;:&quot;&quot;,&quot;zeroRecords&quot;:&quot;&quot;,&quot;exportLabel&quot;:&quot;&quot;,&quot;file&quot;:&quot;default&quot;}\" data-merged=\"[]\" data-responsive-mode=\"0\" data-from-history=\"0\" style=\"width:100%;\" ><thead><tr><th class=\"\" style=\"width:25%; padding: 0 !important;\"><\/th><th class=\"\" style=\"width:25%; padding: 0 !important;\"><\/th><th class=\"\" style=\"width:25%; padding: 0 !important;\"><\/th><th class=\"\" style=\"width:25%; padding: 0 !important;\"><\/th><\/tr><\/thead><tbody><tr ><td data-cell-id=\"A1\" data-x=\"0\" data-y=\"1\" class=\"bg-aeb3ac\" data-cell-type=\"text\" data-original-value=\"Endpoint\" data-order=\"Endpoint\" style=\"min-width:25%; \" >Endpoint <\/td><td data-cell-id=\"B1\" data-x=\"1\" data-y=\"1\" class=\"bg-aeb3ac\" data-cell-type=\"text\" data-original-value=\"HTTP Method\" data-order=\"HTTP Method\" style=\"min-width:25%; \" >HTTP Method <\/td><td data-cell-id=\"C1\" data-x=\"2\" data-y=\"1\" class=\"bg-aeb3ac\" data-cell-type=\"text\" data-original-value=\"CRUD Method\" data-order=\"CRUD Method\" style=\"min-width:25%; \" >CRUD Method <\/td><td data-cell-id=\"D1\" data-x=\"3\" data-y=\"1\" class=\"bg-aeb3ac\" data-cell-type=\"text\" data-original-value=\"Result\" data-order=\"Result\" style=\"min-width:25%; \" >Result <\/td><\/tr><tr ><td data-cell-id=\"A2\" data-x=\"0\" data-y=\"2\" class=\"\" data-cell-type=\"text\" data-original-value=\"posts\/\" data-order=\"posts\/\" >posts\/ <\/td><td data-cell-id=\"B2\" data-x=\"1\" data-y=\"2\" class=\"\" data-cell-type=\"text\" data-original-value=\"GET\" data-order=\"GET\" >GET <\/td><td data-cell-id=\"C2\" data-x=\"2\" data-y=\"2\" class=\"\" data-cell-type=\"text\" data-original-value=\"READ\" data-order=\"READ\" >READ <\/td><td data-cell-id=\"D2\" data-x=\"3\" data-y=\"2\" class=\"\" data-cell-type=\"text\" data-original-value=\"Get all posts\" data-order=\"Get all posts\" >Get all posts <\/td><\/tr><tr ><td data-cell-id=\"A3\" data-x=\"0\" data-y=\"3\" class=\"\" data-cell-type=\"text\" data-original-value=\"posts\/\" data-order=\"posts\/\" >posts\/ <\/td><td data-cell-id=\"B3\" data-x=\"1\" data-y=\"3\" class=\"\" data-cell-type=\"text\" data-original-value=\"POST\" data-order=\"POST\" >POST <\/td><td data-cell-id=\"C3\" data-x=\"2\" data-y=\"3\" class=\"\" data-cell-type=\"text\" data-original-value=\"CREATE\" data-order=\"CREATE\" >CREATE <\/td><td data-cell-id=\"D3\" data-x=\"3\" data-y=\"3\" class=\"\" data-cell-type=\"text\" data-original-value=\"Create new post\" data-order=\"Create new post\" >Create new post <\/td><\/tr><tr ><td data-cell-id=\"A4\" data-x=\"0\" data-y=\"4\" class=\"\" data-cell-type=\"text\" data-original-value=\"posts\/:id\" data-order=\"posts\/:id\" >posts\/:id <\/td><td data-cell-id=\"B4\" data-x=\"1\" data-y=\"4\" class=\"\" data-cell-type=\"text\" data-original-value=\"GET\" data-order=\"GET\" >GET <\/td><td data-cell-id=\"C4\" data-x=\"2\" data-y=\"4\" class=\"\" data-cell-type=\"text\" data-original-value=\"READ\" data-order=\"READ\" >READ <\/td><td data-cell-id=\"D4\" data-x=\"3\" data-y=\"4\" class=\"\" data-cell-type=\"text\" data-original-value=\"Get post details\" data-order=\"Get post details\" >Get post details <\/td><\/tr><tr ><td data-cell-id=\"A5\" data-x=\"0\" data-y=\"5\" class=\"\" data-cell-type=\"text\" data-original-value=\"posts\/:id\" data-order=\"posts\/:id\" >posts\/:id <\/td><td data-cell-id=\"B5\" data-x=\"1\" data-y=\"5\" class=\"\" data-cell-type=\"text\" data-original-value=\"PUT\" data-order=\"PUT\" >PUT <\/td><td data-cell-id=\"C5\" data-x=\"2\" data-y=\"5\" class=\"\" data-cell-type=\"text\" data-original-value=\"UPDATE\" data-order=\"UPDATE\" >UPDATE <\/td><td data-cell-id=\"D5\" data-x=\"3\" data-y=\"5\" class=\"\" data-cell-type=\"text\" data-original-value=\"Update post\" data-order=\"Update post\" >Update post <\/td><\/tr><tr ><td data-cell-id=\"A6\" data-x=\"0\" data-y=\"6\" class=\"\" data-cell-type=\"text\" data-original-value=\"posts\/:id\" data-order=\"posts\/:id\" >posts\/:id <\/td><td data-cell-id=\"B6\" data-x=\"1\" data-y=\"6\" class=\"\" data-cell-type=\"text\" data-original-value=\"PATCH\" data-order=\"PATCH\" >PATCH <\/td><td data-cell-id=\"C6\" data-x=\"2\" data-y=\"6\" class=\"\" data-cell-type=\"text\" data-original-value=\"UPDATE\" data-order=\"UPDATE\" >UPDATE <\/td><td data-cell-id=\"D6\" data-x=\"3\" data-y=\"6\" class=\"\" data-cell-type=\"text\" data-original-value=\"Partial update of post\" data-order=\"Partial update of post\" >Partial update of post <\/td><\/tr><tr ><td data-cell-id=\"A7\" data-x=\"0\" data-y=\"7\" class=\"\" data-cell-type=\"text\" data-original-value=\"posts\/:id\" data-order=\"posts\/:id\" >posts\/:id <\/td><td data-cell-id=\"B7\" data-x=\"1\" data-y=\"7\" class=\"\" data-cell-type=\"text\" data-original-value=\"DELETE\" data-order=\"DELETE\" >DELETE <\/td><td data-cell-id=\"C7\" data-x=\"2\" data-y=\"7\" class=\"\" data-cell-type=\"text\" data-original-value=\"DELETE\" data-order=\"DELETE\" >DELETE <\/td><td data-cell-id=\"D7\" data-x=\"3\" data-y=\"7\" class=\"\" data-cell-type=\"text\" data-original-value=\"Delete post\" data-order=\"Delete post\" >Delete post <\/td><\/tr><tr ><td data-cell-id=\"A8\" data-x=\"0\" data-y=\"8\" class=\"\" data-cell-type=\"text\" data-original-value=\"posts\/:id\" data-order=\"posts\/:id\" >posts\/:id <\/td><td data-cell-id=\"B8\" data-x=\"1\" data-y=\"8\" class=\"\" data-cell-type=\"text\" data-original-value=\"OPTIONS\" data-order=\"OPTIONS\" >OPTIONS <\/td><td data-cell-id=\"C8\" data-x=\"2\" data-y=\"8\" class=\"\" data-cell-type=\"text\" data-original-value=\"\" data-order=\"\" ><\/td><td data-cell-id=\"D8\" data-x=\"3\" data-y=\"8\" class=\"\" data-cell-type=\"text\" data-original-value=\"Return supported HTTP methods\" data-order=\"Return supported HTTP methods\" >Return supported HTTP methods <\/td><\/tr><\/tbody><\/table><!-- \/#supsystic-table-19.supsystic-table --><\/div><!-- \/.supsystic-tables-wrap --><!-- Tables Generator by Supsystic --><!-- Version:1.9.77 --><!-- http:\/\/supsystic.com\/ --><\/p>\n<h3>How to Write Tests<\/h3>\n<p>With the <a href=\"https:\/\/docs.python.org\/3\/library\/unittest.html\" rel=\"nofollow\">unittests<\/a> framework, writing tests becomes very easy.<br \/>\nOpen the<code>\u2018api\/django_blog\/apps\/blog\/tests\/test_models.py\u2019<\/code>file and add the following code:<br \/>\n<div class=\"oembed-gist\"><script src=\"https:\/\/gist.github.com\/olegkovalov\/aa0c029c00ae29f39269517b36eab55d.js?file=test_models.py\"><\/script><noscript>View the code on <a href=\"https:\/\/gist.github.com\/olegkovalov\/aa0c029c00ae29f39269517b36eab55d\">Gist<\/a>.<\/noscript><\/div><br \/>\nOpen the<code>\u2018api\/django_blog\/apps\/blog\/models\/post.py\u2019<\/code>file, and define models for Post and Tags:<br \/>\n<div class=\"oembed-gist\"><script src=\"https:\/\/gist.github.com\/olegkovalov\/e9ddacb705b79fa9fdf7763a1acd26c4.js?file=post.py\"><\/script><noscript>View the code on <a href=\"https:\/\/gist.github.com\/olegkovalov\/e9ddacb705b79fa9fdf7763a1acd26c4\">Gist<\/a>.<\/noscript><\/div><br \/>\nOur Post model inherits from <code>\u2018CoreModel\u2019<\/code>, so fields and methods defined in <code>\u2018CoreModel\u2019<\/code> can be added to the <code>\u2018Post\u2019<\/code> model.<\/p>\n<p style=\"padding-left: 40px;\">N.B.: Remember to launch <code>\u2018.\/manage.py makemigrations\u2019<\/code> and <code>\u2018.\/manage.py migrate\u2019<\/code> commands after each model variation.<\/p>\n<p>Now, let\u2019s run our first test on the models we\u2019ve created:<\/p>\n<pre><code>$ python manage.py test<\/code><\/pre>\n<p><div class=\"oembed-gist\"><script src=\"https:\/\/gist.github.com\/olegkovalov\/13f0108a08d45d63b99934a9ed63b533.js?file=shell\"><\/script><noscript>View the code on <a href=\"https:\/\/gist.github.com\/olegkovalov\/13f0108a08d45d63b99934a9ed63b533\">Gist<\/a>.<\/noscript><\/div><br \/>\nThis means that the test was run successfully.<\/p>\n<p>Open<code>\u2018api\/django_blog\/apps\/blog\/tests\/tests.py\u2019<\/code>and add tests for your API:<br \/>\n<div class=\"oembed-gist\"><script src=\"https:\/\/gist.github.com\/olegkovalov\/2895a23a3f4a43b7a52860e58042098a.js?file=tests.py\"><\/script><noscript>View the code on <a href=\"https:\/\/gist.github.com\/olegkovalov\/2895a23a3f4a43b7a52860e58042098a\">Gist<\/a>.<\/noscript><\/div><\/p>\n<h2>Serializers<\/h2>\n<p>A <a href=\"https:\/\/www.django-rest-framework.org\/api-guide\/serializers\/#serializers\">serializer<\/a> is a framework that allows complex data such as querysets and model instances to be converted to native Python data types. Then, these can then be easily rendered into <span style=\"color: #333333;\">JSON, XML<\/span> or other content types. Serializers also work in the opposite direction \u2013 deserializing allows parsed data to be converted back into complex types after having validated the incoming data. The serializers in the REST framework work in a way similar to Django&#8217;s Form and ModelForm classes.<\/p>\n<h3>Declare Serializers<\/h3>\n<p>Open<code>\u2018api\/django_blog\/apps\/blog\/rest_api\/serializers\/post.py\u2019<\/code>and add:<br \/>\n<div class=\"oembed-gist\"><script src=\"https:\/\/gist.github.com\/olegkovalov\/27cf670dd205c81193a3eb6b3b6a9e15.js?file=post.py\"><\/script><noscript>View the code on <a href=\"https:\/\/gist.github.com\/olegkovalov\/27cf670dd205c81193a3eb6b3b6a9e15\">Gist<\/a>.<\/noscript><\/div><br \/>\nNow, we can use the <code>PostSerializer<\/code> to serialize a post, or list of posts.<br \/>\n<div class=\"oembed-gist\"><script src=\"https:\/\/gist.github.com\/olegkovalov\/3d8349fc890bc57411779fea352918cb.js?file=serialize_post.py\"><\/script><noscript>View the code on <a href=\"https:\/\/gist.github.com\/olegkovalov\/3d8349fc890bc57411779fea352918cb\">Gist<\/a>.<\/noscript><\/div><br \/>\nOpen<code>\u2018api\/django_blog\/apps\/blog\/rest_api\/views\/blog_views.py'<\/code>and add the following code to define API view:<br \/>\n<div class=\"oembed-gist\"><script src=\"https:\/\/gist.github.com\/olegkovalov\/265e8c9e5c11197b8ea85c134ca431c3.js?file=blog_views.py\"><\/script><noscript>View the code on <a href=\"https:\/\/gist.github.com\/olegkovalov\/265e8c9e5c11197b8ea85c134ca431c3\">Gist<\/a>.<\/noscript><\/div><br \/>\nAdd the URLs of your endpoints to<\/p>\n<p><code>\u2018api\/django_blog\/apps\/blog\/rest_api\/urls.py\u2019<\/code>.This will be the URL where your API will be available.<br \/>\n<div class=\"oembed-gist\"><script src=\"https:\/\/gist.github.com\/olegkovalov\/0298e6547070cca146d293f318451d74.js?file=urls.py\"><\/script><noscript>View the code on <a href=\"https:\/\/gist.github.com\/olegkovalov\/0298e6547070cca146d293f318451d74\">Gist<\/a>.<\/noscript><\/div><br \/>\nOpen<code>\u2018api\/urls.py\u2019<\/code>and include the blog\u2019s application URLs:<br \/>\n<div class=\"oembed-gist\"><script src=\"https:\/\/gist.github.com\/olegkovalov\/8ea27c5149ba9fbe4e6e2d4aa71bf7f0.js?file=django_blog_api_urls.py\"><\/script><noscript>View the code on <a href=\"https:\/\/gist.github.com\/olegkovalov\/8ea27c5149ba9fbe4e6e2d4aa71bf7f0\">Gist<\/a>.<\/noscript><\/div><\/p>\n<h3>Run Tests<\/h3>\n<p>Now, you can test your API using the following command:<\/p>\n<pre><code>$ python manage.py test<\/code><\/pre>\n<p><div class=\"oembed-gist\"><script src=\"https:\/\/gist.github.com\/olegkovalov\/a96fcf8509496032ed7bf4a6ba6a9b54.js?file=shell\"><\/script><noscript>View the code on <a href=\"https:\/\/gist.github.com\/olegkovalov\/a96fcf8509496032ed7bf4a6ba6a9b54\">Gist<\/a>.<\/noscript><\/div><br \/>\nVoila! The test has been completed successfully.<br \/>\n<div class=\"info_box_shortcode_holder\" style=\"background-image: url(https:\/\/djangostars.com\/blog\/wp-content\/uploads\/2023\/08\/Web-Development_1.png)\">\n    <div class=\"info_box_label\">\n    Services\n    <\/div>\n    <div class=\"info_box_logo\">\n    \n    <\/div>\n    \n    <div class=\"info_box_title font_size_\">\n   <span class=\"info_box_title_inner\">Boost your web development.&lt;br \/&gt;\n<\/span>\n    <\/div>\n    <div class=\"info_box_link\">\n        <a href=\"https:\/\/djangostars.com\/services\/web-development\/\" target=\"_blank\" >\n            <span>Learn More<\/span>\n            <div class=\"button_animated\">\n                <svg width=\"24\" height=\"12\" viewBox=\"0 0 24 12\" fill=\"none\"\n                     xmlns=\"http:\/\/www.w3.org\/2000\/svg\">\n                    <path d=\"M23.725 5.33638C23.7248 5.3361 23.7245 5.33577 23.7242 5.33549L18.8256 0.460497C18.4586 0.0952939 17.865 0.096653 17.4997 0.463684C17.1345 0.830668 17.1359 1.42425 17.5028 1.7895L20.7918 5.06249H0.9375C0.419719 5.06249 0 5.48221 0 5.99999C0 6.51777 0.419719 6.93749 0.9375 6.93749H20.7917L17.5029 10.2105C17.1359 10.5757 17.1345 11.1693 17.4998 11.5363C17.865 11.9034 18.4587 11.9046 18.8256 11.5395L23.7242 6.66449C23.7245 6.66421 23.7248 6.66388 23.7251 6.6636C24.0923 6.29713 24.0911 5.70163 23.725 5.33638Z\"\n                          fill=\"#282828\"><\/path>\n                <\/svg>\n                <div class=\"shape\"><\/div>\n            <\/div>\n        <\/a>\n    <\/div>\n<\/div><\/p>\n<h2>Browsable API<\/h2>\n<p>API may stand for Application Programming Interface, but humans have to be able to read the APIs, too \u2013 someone has to do the programming. Hence the <a href=\"https:\/\/www.django-rest-framework.org\/topics\/browsable-api\/#the-browsable-api\">browsable API<\/a>. With the Django REST Framework, you can generate a human-friendly HTML output for each resource when an HTML format is requested. These pages allow you to easily browse through resources, as well as build in forms to submit data to the resources using POST, PUT, and DELETE.<\/p>\n<p>Let\u2019s test our API with the browsable REST Framework interface. First, start the development server:<\/p>\n<pre><code>$ python manage.py runserver_plus<\/code><\/pre>\n<p>Then, open your browser of choice and visit this <a href=\"http:\/\/127.0.0.1:8000\/api\/v1\/posts\/\" rel=\"nofollow\">url<\/a>:<br \/>\n<img decoding=\"async\" src=\"https:\/\/djangostars.com\/blog\/wp-content\/uploads\/2022\/09\/DRF-Post-List-Create-API.png\" alt=\"DRF-Post-List-Create-API\" \/><br \/>\nCreate a new post with an image file. Fill out the fields \u201cTitle\u201d and \u201cText\u201d, choose an image file in the form at the bottom, and press \u201cPOST\u201d. The page will reload with the new content.<br \/>\n<img decoding=\"async\" src=\"https:\/\/djangostars.com\/blog\/wp-content\/uploads\/2022\/09\/Django-REST-framework-Create-a-Post.png\" alt=\"Django-REST-framework-Create-a-Post\" \/><br \/>\nIf you want to work with a real post, feel free to visit this <a href=\"http:\/\/127.0.0.1:8000\/api\/v1\/posts\/d6f814b3-9ebf-4221-ab33-54373f5896b5\/\" rel=\"nofollow\">page<\/a>.<\/p>\n<h3>Versioning<\/h3>\n<p>Versioning is a vital part of API design that allows you to improve the representation for the resources of your API and alter behavior between different clients. The REST framework provides a number of different versioning schemes. Versioning is determined by the incoming client request, and may either be based on the request URL or the request headers.<\/p>\n<p>In this example, we use the url path versioning approach.<\/p>\n<p>Open <code>\u2018api\/django_blog\/settings\/django.py\u2019<\/code> and add:<br \/>\n<div class=\"oembed-gist\"><script src=\"https:\/\/gist.github.com\/olegkovalov\/fb2fd307bf328c40cd33908c8c1e1728.js?file=settings_rest_framework.py\"><\/script><noscript>View the code on <a href=\"https:\/\/gist.github.com\/olegkovalov\/fb2fd307bf328c40cd33908c8c1e1728\">Gist<\/a>.<\/noscript><\/div><br \/>\nIf the response was changed and you decide to define a different API version, you might handle it as follows:<br \/>\n<div class=\"oembed-gist\"><script src=\"https:\/\/gist.github.com\/olegkovalov\/b65dd4bea889a1d1264380075be1174d.js?file=versioning_example.py\"><\/script><noscript>View the code on <a href=\"https:\/\/gist.github.com\/olegkovalov\/b65dd4bea889a1d1264380075be1174d\">Gist<\/a>.<\/noscript><\/div><\/p>\n<h3>Documenting Your API<\/h3>\n<p>The REST framework provides built-in support for generating OpenAPI schemas. These can be used with tools that allow you to build API documentation.<\/p>\n<p>The browsable API that the REST framework provides allows your API to be entirely self- describing. You can get the documentation for each API endpoint by simply visiting the URL in your browser.<\/p>\n<p>However, there\u2019s also a number of great third-party documentation packages available. For instance, let\u2019s try to integrate <a href=\"https:\/\/github.com\/axnsan12\/drf-yasg\" rel=\"nofollow\">drf-yasg<\/a>. Its goal is to implement as much of the <a href=\"https:\/\/www.openapis.org\/\">OpenAPI<\/a> specification as possible (nested schemas, named models, response bodies, enum\/pattern\/min\/max validators, form parameters, etc.) and generate documents that can be used with code-generation tools.<\/p>\n<p>Open the terminal, and type in:<\/p>\n<pre><code>$ pip install -U drf-yasg<\/code><\/pre>\n<p>Open <code>\u2018api\/django_blog\/settings\/django.py\u2019<\/code> and add the INSTALLED_APPS <code>\u2018drf_yasg\u2019<\/code> package:<br \/>\n<div class=\"oembed-gist\"><script src=\"https:\/\/gist.github.com\/olegkovalov\/4054f97d52522c58f779813f379ced9a.js?file=settings_installed_apps_drf_yasg.py\"><\/script><noscript>View the code on <a href=\"https:\/\/gist.github.com\/olegkovalov\/4054f97d52522c58f779813f379ced9a\">Gist<\/a>.<\/noscript><\/div><br \/>\nAlso, we should include URLs, for generated\u00a0Django REST framework documentation:<br \/>\n<div class=\"oembed-gist\"><script src=\"https:\/\/gist.github.com\/olegkovalov\/1efedebf06bfd95945439e7c7fe53769.js?file=urls.py\"><\/script><noscript>View the code on <a href=\"https:\/\/gist.github.com\/olegkovalov\/1efedebf06bfd95945439e7c7fe53769\">Gist<\/a>.<\/noscript><\/div><br \/>\nYou can find the documentation on your API in this document.<br \/>\n<img decoding=\"async\" class=\"alignnone size-full wp-image-1595\" src=\"https:\/\/djangostars.com\/blog\/wp-content\/uploads\/2022\/09\/API-Posts-List.png\" alt=\"django-rest-API-Posts-List\" \/><br \/>\nIf you want to implement new features or play around, feel free to clone or fork my <a href=\"https:\/\/github.com\/olegkovalov\/django_blog\">git hub repo<\/a>.<\/p>\n<p><!--h2><b>Which Famous Companies Are Using Django REST Framework?<\/b><\/h2>\n\n\nDRF is a versatile library, and its adoption by various internationally recognized companies underscores its reliability in building efficient Web APIs.\n\n\n<ul>\n \t\n\n<li><a href=\"https:\/\/www.mozilla.org\/\"><b>Mozilla<\/b><\/a>, the organization behind the popular Firefox browser, leverages DRF to build scalable and efficient web applications. Mozilla's endorsement reflects DRF\u2019s capability to handle complex structures and high traffic.<\/li>\n\n\n \t\n\n<li><a href=\"https:\/\/www.redhat.com\/en\"><b>Red Hat<\/b><\/a><b>,<\/b> a multinational software company, utilizes DRF for several applications, highlighting the framework's adaptability and robustness in diverse software environments.<\/li>\n\n\n \t\n\n<li><a href=\"https:\/\/www.heroku.com\/\"><b>Heroku<\/b><\/a>, a cloud platform offering Platform as a Service (PaaS), employs DRF to develop flexible and user-friendly APIs. The usage of DRF by Heroku illustrates its compatibility with cloud-based solutions and its ability to meet the needs of diverse applications.<\/li>\n\n\n \t\n\n<li><a href=\"https:\/\/www.eventbrite.com\/\"><b>Eventbrite<\/b><\/a>, a global ticketing and event technology platform, utilizes DRF to handle vast amounts of data and transactions securely. This demonstrates DRF's proficiency in managing high-volume data traffic and its reliability in transaction processing.<\/li>\n\n\n \t\n\n<li><a href=\"https:\/\/www.instagram.com\/\"><b>Instagram<\/b><\/a>, a prominent social media platform, relies on DRF to facilitate seamless interaction between its various components and services. Instagram\u2019s preference for DRF emphasizes its capability in delivering responsive and efficient services in a high-demand environment.<\/li>\n\n\n \t\n\n<li><a href=\"https:\/\/www.pinterest.com\/\"><b>Pinterest<\/b><\/a>, a visual discovery engine, leverages DRF to optimize its user interactions and manage its extensive data efficiently. This showcases the framework\u2019s strength in managing extensive databases and enhancing user engagement.<\/li>\n\n\n \t\n\n<li><a href=\"https:\/\/prezi.com\/\"><b>Prezi<\/b><\/a>, a presentation software company, employs DRF for its adaptability and efficiency in creating interactive and dynamic presentations. It signifies the framework\u2019s versatility in developing a range of applications with diverse requirements.<\/li>\n\n\n<\/ul>\n\n\nThese companies, each with its unique set of requirements and challenges, have opted for DRF due to its flexibility, scalability, and efficiency in developing high-performing Web APIs, attesting to the broad applicability and robustness of the Django REST Framework in real-world scenarios.--><\/p>\n<h2>It\u2019s time to build your REST APIs with Django<\/h2>\n<p>Now, let\u2019s see what we\u2019ve learned about in this Django REST Framework API tutorial. Why is it so practical for building APIs?\u00a0This framework provides a large set of features:<\/p>\n<ul>\n<li>Easy creation of resources with <a href=\"https:\/\/www.django-rest-framework.org\/api-guide\/generic-views\/\" rel=\"nofollow\">Generic Views<\/a> \u2013 they allow you to quickly build API views that map closely to your database models;<\/li>\n<li>An <a href=\"https:\/\/www.django-rest-framework.org\/api-guide\/authentication\/#authentication\" rel=\"nofollow\">authentication<\/a> mechanism associates an incoming request with a set of identifying credentials;<\/li>\n<li><a href=\"https:\/\/www.django-rest-framework.org\/api-guide\/permissions\/\" rel=\"nofollow\">Permissions<\/a> grant access to any authenticated user, and deny access to any unauthenticated user;<\/li>\n<li><a href=\"https:\/\/www.django-rest-framework.org\/api-guide\/throttling\/\" rel=\"nofollow\">Throttling<\/a> indicates a temporary state, and is used to control the rate of requests that clients can make to an API;<\/li>\n<li><a href=\"https:\/\/www.django-rest-framework.org\/api-guide\/caching\/\" rel=\"nofollow\">Caching<\/a> through cache utilities provided by Django;<\/li>\n<li><a href=\"https:\/\/www.django-rest-framework.org\/api-guide\/filtering\/\" rel=\"nofollow\">Filtering<\/a> allows you to restrict the items that are returned in response;<\/li>\n<li><a href=\"https:\/\/www.django-rest-framework.org\/api-guide\/pagination\/\" rel=\"nofollow\">Pagination<\/a> allows you to choose how large result sets will be split into individual pages of data;<\/li>\n<li><a href=\"https:\/\/www.django-rest-framework.org\/api-guide\/status-codes\/\" rel=\"nofollow\">Status Codes<\/a> \u2013 the REST framework includes a set of named constants you can use to make your code more transparent and readable;<\/li>\n<li><a href=\"https:\/\/www.django-rest-framework.org\/api-guide\/versioning\/\" rel=\"nofollow\">Versioning<\/a> to alter behavior between different clients; and<\/li>\n<li><a href=\"https:\/\/www.django-rest-framework.org\/topics\/browsable-api\/\" rel=\"nofollow\">The Browsable API<\/a> enables you to read the APIs.<\/li>\n<\/ul>\n<p>If you have questions on <a href=\"https:\/\/djangostars.com\/blog\/configuring-django-settings-best-practices\/\">Django settings<\/a> and would love to learn more, there\u2019s plenty of great Python Django REST API tutorials and resources for self-improvement. Here\u2019s a <a href=\"https:\/\/www.django-rest-framework.org\/community\/tutorials-and-resources\/\" rel=\"nofollow\">reading list<\/a> our software development team Django Stars highly recommends. And if by any chance you have to deal with nested objects, here\u2019s a useful <a href=\"https:\/\/github.com\/beda-software\/drf-writable-nested\" rel=\"nofollow\">library<\/a> that might come in handy. Also, feel free to visit the django_blog repository for ideas and inspiration. But as I said before, if you know your basics well, you can build upon this knowledge. And considering how universal APIs are, you\u2019ll be able to work with any kind of product, which will make you an indispensable team member and a universal soldier of software development.<div class=\"lead-form-wrapper lets_disqus\">\n    <div class=\"lead-form transparent-footer\">\n        <p class=\"discuss-title paragraph-discuss col-md-12\">Have an idea? Let&#039;s discuss!<\/p>\n\n        \n<div class=\"wpcf7 no-js\" id=\"wpcf7-f2589-o1\" lang=\"en-US\" dir=\"ltr\" data-wpcf7-id=\"2589\">\n<div class=\"screen-reader-response\"><p role=\"status\" aria-live=\"polite\" aria-atomic=\"true\"><\/p> <ul><\/ul><\/div>\n<form action=\"\/blog\/wp-json\/wp\/v2\/posts\/1597#wpcf7-f2589-o1\" method=\"post\" class=\"wpcf7-form init\" aria-label=\"Contact form\" enctype=\"multipart\/form-data\" novalidate=\"novalidate\" data-status=\"init\">\n<div style=\"display: none;\">\n<input type=\"hidden\" name=\"_wpcf7\" value=\"2589\" \/>\n<input type=\"hidden\" name=\"_wpcf7_version\" value=\"6.0.6\" \/>\n<input type=\"hidden\" name=\"_wpcf7_locale\" value=\"en_US\" \/>\n<input type=\"hidden\" name=\"_wpcf7_unit_tag\" value=\"wpcf7-f2589-o1\" \/>\n<input type=\"hidden\" name=\"_wpcf7_container_post\" value=\"0\" \/>\n<input type=\"hidden\" name=\"_wpcf7_posted_data_hash\" value=\"\" \/>\n<input type=\"hidden\" name=\"form_start_time\" value=\"1775680407\" \/>\n<input type=\"hidden\" name=\"_wpcf7_recaptcha_response\" value=\"\" \/>\n<\/div>\n<div class=\"form_holder\">\n    <div class=\"input_section input_row\">\n        <div class=\"input_holder\">\n                            <span class=\"input_label\">\n                               Your name *\n                            <\/span>\n            <input size=\"40\" maxlength=\"400\" class=\"wpcf7-form-control wpcf7-text wpcf7-validates-as-required\" id=\"your-name\" aria-required=\"true\" aria-invalid=\"false\" value=\"\" type=\"text\" name=\"text-898\" \/>\n\n            <input class=\"wpcf7-form-control wpcf7-hidden\" id=\"uniq_ga_id\" value=\"\" type=\"hidden\" name=\"uniq_ga_id\" \/>\n        <\/div>\n        <div class=\"input_holder\">\n                            <span class=\"input_label\">\n                                Your email *\n                            <\/span>\n            <input size=\"40\" maxlength=\"400\" class=\"wpcf7-form-control wpcf7-email wpcf7-validates-as-required wpcf7-text wpcf7-validates-as-email\" id=\"your-email\" aria-required=\"true\" aria-invalid=\"false\" value=\"\" type=\"email\" name=\"email-882\" \/>\n        <\/div>\n    <\/div>\n    <div class=\"input_section single_input_row\">\n        <div class=\"input_holder\">\n            <span class=\"input_label\">How can we help you? *<\/span>\n            <input size=\"40\" maxlength=\"400\" class=\"wpcf7-form-control wpcf7-text\" id=\"message\" aria-invalid=\"false\" value=\"\" type=\"text\" name=\"message\" \/>\n        <\/div>\n    <\/div>\n    <div class=\"file_attach\">\n        <input size=\"40\" class=\"wpcf7-form-control wpcf7-file\" accept=\"audio\/*,video\/*,image\/*\" aria-invalid=\"false\" type=\"file\" name=\"file-930\" \/>\n        <div class=\"file_placeholder\">\ud83d\udcce <span>Attach File<\/span>\n            <span class=\"file_formats\">Formats: pdf, doc, docx, rtf, ppt, pptx.<\/span><\/div>\n    <\/div>\n    <div class=\"checkbox_row\">\n        <div class=\"single_checkbox\"><div class=\"checkbox_indicator\"><div class=\"checked_indicator\"><svg width=\"14\" height=\"12\" viewBox=\"0 0 14 12\" fill=\"none\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\"><path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M4.66804 12L0 7.26951L1.22426 6.05269L4.54927 9.40456L12.6737 0L14 1.10613L4.66804 12Z\" fill=\"#1E232C\"\/><\/svg><\/div><\/div><input type=\"checkbox\" name=\"agree\" id=\"privacy\" value=\"agree privacy\"><label for=\"privacy\" class=\"\">I have read and accepted <a href=\"https:\/\/djangostars.com\/privacy-policy\/\" style=\"margin-left: 6px;\"> Privacy Policy*<\/a><\/label><\/div>\n        <div class=\"single_checkbox\"><div class=\"checkbox_indicator\"><div class=\"checked_indicator\"><svg width=\"14\" height=\"12\" viewBox=\"0 0 14 12\" fill=\"none\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\"><path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M4.66804 12L0 7.26951L1.22426 6.05269L4.54927 9.40456L12.6737 0L14 1.10613L4.66804 12Z\" fill=\"#1E232C\"\/><\/svg><\/div><\/div><input type=\"checkbox\" name=\"agree\" id=\"marketing\" value=\"agree for marketing\"><label for=\"marketing\" class=\"\">I agree to receive marketing content from Django Stars<\/label><\/div>\n    <\/div>\n    <div class=\"submit\"><button type=\"submit\"><span>send message<\/span><\/button><div class=\"safeguard\">We safeguard your privacy<\/div><\/div>\n<\/div>\n<div style=\"position: absolute; left: -5000px;\" aria-hidden=\"true\">\n    <input size=\"40\" maxlength=\"400\" class=\"wpcf7-form-control wpcf7-text\" aria-invalid=\"false\" value=\"\" type=\"text\" name=\"website_url\" \/>\n<\/div><script type='text\/javascript'>\n\n\t\t\t\t\t\tif(contactform === undefined){\n\t\t\t\t\t\t\tvar contactform = [];\n\t\t\t\t\t\t}\n\t\t\t\t\t\tvar innerVal = [2589,'mail_sent_ok','Thank you for your message. It has been sent.'];\n\t\t\t\t\t\tcontactform.push(innerVal);\n\t\t\t\t\t\tvar innerVal = [2589,'mail_sent_ng','There was an error trying to send your message. Please try again later.'];\n\t\t\t\t\t\tcontactform.push(innerVal);\n\t\t\t\t\t\tvar innerVal = [2589,'validation_error','One or more fields have an error. Please check and try again.'];\n\t\t\t\t\t\tcontactform.push(innerVal);\n\t\t\t\t\t\tvar innerVal = [2589,'spam','There was an error trying to send your message. Please try again later.'];\n\t\t\t\t\t\tcontactform.push(innerVal);\n\t\t\t\t\t\tvar innerVal = [2589,'accept_terms','You must accept the terms and conditions before sending your message.'];\n\t\t\t\t\t\tcontactform.push(innerVal);\n\t\t\t\t\t\tvar innerVal = [2589,'invalid_required','The field is required.'];\n\t\t\t\t\t\tcontactform.push(innerVal);\n\t\t\t\t\t\tvar innerVal = [2589,'invalid_too_long','The field is too long.'];\n\t\t\t\t\t\tcontactform.push(innerVal);\n\t\t\t\t\t\tvar innerVal = [2589,'invalid_too_short','The field is too short.'];\n\t\t\t\t\t\tcontactform.push(innerVal);\n\t\t\t\t\t\tvar innerVal = [2589,'upload_failed','There was an unknown error uploading the file.'];\n\t\t\t\t\t\tcontactform.push(innerVal);\n\t\t\t\t\t\tvar innerVal = [2589,'upload_file_type_invalid','You are not allowed to upload files of this type.'];\n\t\t\t\t\t\tcontactform.push(innerVal);\n\t\t\t\t\t\tvar innerVal = [2589,'upload_file_too_large','The file is too big.'];\n\t\t\t\t\t\tcontactform.push(innerVal);\n\t\t\t\t\t\tvar innerVal = [2589,'upload_failed_php_error','There was an error uploading the file.'];\n\t\t\t\t\t\tcontactform.push(innerVal);\n\t\t\t\t\t\tvar innerVal = [2589,'invalid_date','The date format is incorrect.'];\n\t\t\t\t\t\tcontactform.push(innerVal);\n\t\t\t\t\t\tvar innerVal = [2589,'date_too_early','The date is before the earliest one allowed.'];\n\t\t\t\t\t\tcontactform.push(innerVal);\n\t\t\t\t\t\tvar innerVal = [2589,'date_too_late','The date is after the latest one allowed.'];\n\t\t\t\t\t\tcontactform.push(innerVal);\n\t\t\t\t\t\tvar innerVal = [2589,'invalid_number','The number format is invalid.'];\n\t\t\t\t\t\tcontactform.push(innerVal);\n\t\t\t\t\t\tvar innerVal = [2589,'number_too_small','The number is smaller than the minimum allowed.'];\n\t\t\t\t\t\tcontactform.push(innerVal);\n\t\t\t\t\t\tvar innerVal = [2589,'number_too_large','The number is larger than the maximum allowed.'];\n\t\t\t\t\t\tcontactform.push(innerVal);\n\t\t\t\t\t\tvar innerVal = [2589,'quiz_answer_not_correct','The answer to the quiz is incorrect.'];\n\t\t\t\t\t\tcontactform.push(innerVal);\n\t\t\t\t\t\tvar innerVal = [2589,'invalid_email','The e-mail address entered is invalid.'];\n\t\t\t\t\t\tcontactform.push(innerVal);\n\t\t\t\t\t\tvar innerVal = [2589,'invalid_url','The URL is invalid.'];\n\t\t\t\t\t\tcontactform.push(innerVal);\n\t\t\t\t\t\tvar innerVal = [2589,'invalid_tel','The telephone number is invalid.'];\n\t\t\t\t\t\tcontactform.push(innerVal);\n\t\t\t\t\t\tvar innerVal = [2589,'gdpr',''];\n\t\t\t\t\t\tcontactform.push(innerVal);\n\t\t\t\t\t\t<\/script><div class=\"wpcf7-response-output\" aria-hidden=\"true\"><\/div>\n<\/form>\n<\/div>\n    <\/div>\n\n    <div class=\"success_disqus\">\n        Thank you for your message.\n        <span>We\u2019ll contact you shortly<\/span>.\n    <\/div>\n<\/div>\n\n<script>\n    \/\/ (function ($) {\n    function click_input() {\n        jQuery('.file_placeholder').on('click', function () {\n            jQuery(this).parent().find('input').click();\n        })\n    }\n\n    document.addEventListener(\"DOMContentLoaded\", click_input);\n\n    \/\/ })(jQuery)\n<\/script>\n\n\n<div class=\"dj-main-article-faq\" style=\"padding-top: 0px;\">\n\t\t<div class=\"dj-main-article-faq-title\">\n\t\tFrequently Asked Questions\n\t\t<\/div>\n\t\t<div class=\"dj-main-article-faq-items\">\n\t\t\t<div class=\"dj-main-article-faq-accordeon accordeon\"><dl>\n\t\t\t\t<dt>Does Django Stars provide Django Rest framework projects services? \n\t\t\t\t<div class=\"cross\">\n\t\t\t\t<span><\/span>\n\t\t\t\t<span><\/span>\n\t\t\t\t<\/div>\n\t\t\t\t<\/dt>\n\t\t\t\t<dd>Yes, Django Stars, as a software development company, offers services in Django REST framework projects. We specialize in building high-quality, scalable web applications using Django and the Django REST framework, ensuring that our clients receive efficient, robust, and customized solutions tailored to their specific needs. Our expertise in these technologies allows us to deliver top-notch services in developing RESTful APIs and web applications. <\/dd>\n\t\t\t<\/dl><dl>\n\t\t\t\t<dt>How much does Django restful api development cost? \n\t\t\t\t<div class=\"cross\">\n\t\t\t\t<span><\/span>\n\t\t\t\t<span><\/span>\n\t\t\t\t<\/div>\n\t\t\t\t<\/dt>\n\t\t\t\t<dd>The cost of developing a Django RESTful API depends on the project's complexity, the development time, the expertise level of the developers, their geographical location, and the integration of additional technologies. Simple projects could cost a few thousand dollars, while more complex ones may reach tens of thousands. Prices vary, so it's advisable to get multiple quotes for a more accurate estimate tailored to your specific requirements.<\/dd>\n\t\t\t<\/dl><dl>\n\t\t\t\t<dt>Is Django REST Framework easy for web development? \n\t\t\t\t<div class=\"cross\">\n\t\t\t\t<span><\/span>\n\t\t\t\t<span><\/span>\n\t\t\t\t<\/div>\n\t\t\t\t<\/dt>\n\t\t\t\t<dd>Django REST framework (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 and OAuth2, serialization that supports both ORM and non-ORM data sources. Also, it is customizable all the way down, has extensive documentation and great community support.<\/dd>\n\t\t\t<\/dl><dl>\n\t\t\t\t<dt>How to control the process of creating a REST API in Python Django? \n\t\t\t\t<div class=\"cross\">\n\t\t\t\t<span><\/span>\n\t\t\t\t<span><\/span>\n\t\t\t\t<\/div>\n\t\t\t\t<\/dt>\n\t\t\t\t<dd>This can be done using test-driven development (TDD), which is an approach that focuses on writing tests before you start implementing the business logic of your application. This has many benefits, including fast feedback and detailed specification, reduced time spent on reworking and time spent in the debugger, shorter development time to market, SOLID code, and others. TDD tells you whether your last change (or refactoring) broke previously working code. Also, it forces radical simplification of the code, as it should only be written in response to the requirements of the tests.<\/dd>\n\t\t\t<\/dl><dl>\n\t\t\t\t<dt>Can I use Django REST Framework for both small and large-scale projects? \n\t\t\t\t<div class=\"cross\">\n\t\t\t\t<span><\/span>\n\t\t\t\t<span><\/span>\n\t\t\t\t<\/div>\n\t\t\t\t<\/dt>\n\t\t\t\t<dd>Absolutely, you can use DRF for both small and large-scale projects. It is highly scalable and flexible, making it suitable for projects of any size. Its modularity allows it to be as simple or as complex as needed, catering to a range of project requirements. For smaller projects, it can streamline development and for larger, more complex projects, it can handle high volumes of data and traffic, providing robust and efficient solutions.<\/dd>\n\t\t\t<\/dl><dl>\n\t\t\t\t<dt>Are there any security considerations when developing APIs with Django REST Framework? \n\t\t\t\t<div class=\"cross\">\n\t\t\t\t<span><\/span>\n\t\t\t\t<span><\/span>\n\t\t\t\t<\/div>\n\t\t\t\t<\/dt>\n\t\t\t\t<dd>Yes, security is crucial when using Django REST Framework. Ensure proper Authentication and Authorization, use HTTPS for secure data transmission, validate and sanitize inputs, implement throttling, and define clear CORS policies. Regularly update the framework and its dependencies and conduct security audits to identify and address potential vulnerabilities.<\/dd>\n\t\t\t<\/dl><dl>\n\t\t\t\t<dt>How does Django REST Framework handle data serialization? \n\t\t\t\t<div class=\"cross\">\n\t\t\t\t<span><\/span>\n\t\t\t\t<span><\/span>\n\t\t\t\t<\/div>\n\t\t\t\t<\/dt>\n\t\t\t\t<dd>Django REST Framework handles data serialization using serializers that allow complex data types, such as Django models, to be converted to Python data types. The serializers in DRF serve as a bridge between complex querysets and the native Python datatypes, allowing for easy rendering into JSON or XML format for API consumption.<\/dd>\n\t\t\t<\/dl><\/div>\n\t\t\t<\/div>\n\t\t<\/div><\/p>\n","protected":false},"excerpt":{"rendered":"<p>If you know the basics of the field you work in, you can master any technology, reach higher levels as a developer, and create better products. I believe this will be useful for all beginners looking to hire experts with a vast experience in Django web development services, as REST APIs are essential for connecting [&hellip;]<\/p>\n","protected":false},"author":27,"featured_media":3538,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"footnotes":""},"categories":[69,44],"tags":[28,30],"class_list":["post-1597","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-django-engineering","category-python-django","tag-api","tag-backend"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.8 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Software Development Blog &amp; IT Tech Insights | Django Stars<\/title>\n<meta name=\"description\" content=\"Master API development with our Django REST Framework tutorial, guiding you through each step to build robust APIs efficiently and effectively.\" \/>\n<link rel=\"canonical\" href=\"https:\/\/djangostars.com\/blog\/wp-json\/wp\/v2\/posts\/1597\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Using the Django REST Framework to Develop APIs\" \/>\n<meta property=\"og:description\" content=\"Mastering the basics means mastering the craft. This step-by-step guide will teach you how to successfully build APIs \u2013 a communication protocol that\u2019s used in every application you can think of.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/djangostars.com\/blog\/rest-apis-django-development\/\" \/>\n<meta property=\"og:site_name\" content=\"Software Development Blog &amp; IT Tech Insights | Django Stars\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/djangostars\/\" \/>\n<meta property=\"article:published_time\" content=\"2019-10-23T08:29:08+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-09-12T13:10:41+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/djangostars.com\/blog\/uploads\/2019\/10\/cover-2.png\" \/>\n<meta name=\"author\" content=\"Oleg Kovalyov\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:title\" content=\"Using the Django REST Framework to Develop APIs\" \/>\n<meta name=\"twitter:description\" content=\"Mastering the basics means mastering the craft. This step-by-step guide will teach you how to successfully build APIs \u2013 a communication protocol that\u2019s used in every application you can think of.\" \/>\n<meta name=\"twitter:creator\" content=\"@djangostars\" \/>\n<meta name=\"twitter:site\" content=\"@djangostars\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Oleg Kovalyov\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"14 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/djangostars.com\/blog\/rest-apis-django-development\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/djangostars.com\/blog\/rest-apis-django-development\/\"},\"author\":{\"name\":\"Oleg Kovalyov\",\"@id\":\"https:\/\/djangostars.com\/blog\/#\/schema\/person\/f9e65dc651af483f19634c1c0b3fad8e\"},\"headline\":\"How to Develop APIs with Django REST Framework [Step-by-Step Guide]\",\"datePublished\":\"2019-10-23T08:29:08+00:00\",\"dateModified\":\"2025-09-12T13:10:41+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/djangostars.com\/blog\/rest-apis-django-development\/\"},\"wordCount\":3095,\"commentCount\":0,\"image\":{\"@id\":\"https:\/\/djangostars.com\/blog\/rest-apis-django-development\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/djangostars.com\/blog\/wp-content\/uploads\/2021\/12\/How-to-Develop-APIs-with-Django-REST-Framework.jpg\",\"keywords\":[\"API\",\"Backend\"],\"articleSection\":[\"Django Engineering &amp; Dev Expertise for High-Load Projects\",\"Python &amp; Django\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/djangostars.com\/blog\/rest-apis-django-development\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/djangostars.com\/blog\/rest-apis-django-development\/\",\"url\":\"https:\/\/djangostars.com\/blog\/rest-apis-django-development\/\",\"name\":\"How to Develop APIs with Django REST Framework | Django Stars\",\"isPartOf\":{\"@id\":\"https:\/\/djangostars.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/djangostars.com\/blog\/rest-apis-django-development\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/djangostars.com\/blog\/rest-apis-django-development\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/djangostars.com\/blog\/wp-content\/uploads\/2021\/12\/How-to-Develop-APIs-with-Django-REST-Framework.jpg\",\"datePublished\":\"2019-10-23T08:29:08+00:00\",\"dateModified\":\"2025-09-12T13:10:41+00:00\",\"author\":{\"@id\":\"https:\/\/djangostars.com\/blog\/#\/schema\/person\/f9e65dc651af483f19634c1c0b3fad8e\"},\"description\":\"Master API development with our Django REST Framework tutorial, guiding you through each step to build robust APIs efficiently and effectively.\",\"breadcrumb\":{\"@id\":\"https:\/\/djangostars.com\/blog\/rest-apis-django-development\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/djangostars.com\/blog\/rest-apis-django-development\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/djangostars.com\/blog\/rest-apis-django-development\/#primaryimage\",\"url\":\"https:\/\/djangostars.com\/blog\/wp-content\/uploads\/2021\/12\/How-to-Develop-APIs-with-Django-REST-Framework.jpg\",\"contentUrl\":\"https:\/\/djangostars.com\/blog\/wp-content\/uploads\/2021\/12\/How-to-Develop-APIs-with-Django-REST-Framework.jpg\",\"width\":1440,\"height\":620,\"caption\":\"How-to-Develop-APIs-with-Django-REST-Framework\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/djangostars.com\/blog\/rest-apis-django-development\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/djangostars.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Develop APIs with Django REST Framework [Step-by-Step Guide]\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/djangostars.com\/blog\/#website\",\"url\":\"https:\/\/djangostars.com\/blog\/\",\"name\":\"Software Development Blog &amp; IT Tech Insights | Django Stars\",\"description\":\"Welcome behind the scenes of software product development. We share our best practices, tech solutions, management tips, and every useful insight we\u2018ve got while working on our projects.\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/djangostars.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/djangostars.com\/blog\/#\/schema\/person\/f9e65dc651af483f19634c1c0b3fad8e\",\"name\":\"Oleg Kovalyov\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/djangostars.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/e2c16126d1bbc3288771954718cfcb62e6bcd9db02bd60eaf0b68b05065cdba0?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/e2c16126d1bbc3288771954718cfcb62e6bcd9db02bd60eaf0b68b05065cdba0?s=96&d=mm&r=g\",\"caption\":\"Oleg Kovalyov\"},\"sameAs\":[\"https:\/\/www.linkedin.com\/in\/oleg-kovalyov-a43bab103\/\"],\"url\":\"https:\/\/djangostars.com\/blog\/author\/oleg-kovalyov\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Software Development Blog &amp; IT Tech Insights | Django Stars","description":"Master API development with our Django REST Framework tutorial, guiding you through each step to build robust APIs efficiently and effectively.","canonical":"https:\/\/djangostars.com\/blog\/wp-json\/wp\/v2\/posts\/1597","og_locale":"en_US","og_type":"article","og_title":"Using the Django REST Framework to Develop APIs","og_description":"Mastering the basics means mastering the craft. This step-by-step guide will teach you how to successfully build APIs \u2013 a communication protocol that\u2019s used in every application you can think of.","og_url":"https:\/\/djangostars.com\/blog\/rest-apis-django-development\/","og_site_name":"Software Development Blog &amp; IT Tech Insights | Django Stars","article_publisher":"https:\/\/www.facebook.com\/djangostars\/","article_published_time":"2019-10-23T08:29:08+00:00","article_modified_time":"2025-09-12T13:10:41+00:00","og_image":[{"url":"https:\/\/djangostars.com\/blog\/uploads\/2019\/10\/cover-2.png","type":"","width":"","height":""}],"author":"Oleg Kovalyov","twitter_card":"summary_large_image","twitter_title":"Using the Django REST Framework to Develop APIs","twitter_description":"Mastering the basics means mastering the craft. This step-by-step guide will teach you how to successfully build APIs \u2013 a communication protocol that\u2019s used in every application you can think of.","twitter_creator":"@djangostars","twitter_site":"@djangostars","twitter_misc":{"Written by":"Oleg Kovalyov","Est. reading time":"14 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/djangostars.com\/blog\/rest-apis-django-development\/#article","isPartOf":{"@id":"https:\/\/djangostars.com\/blog\/rest-apis-django-development\/"},"author":{"name":"Oleg Kovalyov","@id":"https:\/\/djangostars.com\/blog\/#\/schema\/person\/f9e65dc651af483f19634c1c0b3fad8e"},"headline":"How to Develop APIs with Django REST Framework [Step-by-Step Guide]","datePublished":"2019-10-23T08:29:08+00:00","dateModified":"2025-09-12T13:10:41+00:00","mainEntityOfPage":{"@id":"https:\/\/djangostars.com\/blog\/rest-apis-django-development\/"},"wordCount":3095,"commentCount":0,"image":{"@id":"https:\/\/djangostars.com\/blog\/rest-apis-django-development\/#primaryimage"},"thumbnailUrl":"https:\/\/djangostars.com\/blog\/wp-content\/uploads\/2021\/12\/How-to-Develop-APIs-with-Django-REST-Framework.jpg","keywords":["API","Backend"],"articleSection":["Django Engineering &amp; Dev Expertise for High-Load Projects","Python &amp; Django"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/djangostars.com\/blog\/rest-apis-django-development\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/djangostars.com\/blog\/rest-apis-django-development\/","url":"https:\/\/djangostars.com\/blog\/rest-apis-django-development\/","name":"How to Develop APIs with Django REST Framework | Django Stars","isPartOf":{"@id":"https:\/\/djangostars.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/djangostars.com\/blog\/rest-apis-django-development\/#primaryimage"},"image":{"@id":"https:\/\/djangostars.com\/blog\/rest-apis-django-development\/#primaryimage"},"thumbnailUrl":"https:\/\/djangostars.com\/blog\/wp-content\/uploads\/2021\/12\/How-to-Develop-APIs-with-Django-REST-Framework.jpg","datePublished":"2019-10-23T08:29:08+00:00","dateModified":"2025-09-12T13:10:41+00:00","author":{"@id":"https:\/\/djangostars.com\/blog\/#\/schema\/person\/f9e65dc651af483f19634c1c0b3fad8e"},"description":"Master API development with our Django REST Framework tutorial, guiding you through each step to build robust APIs efficiently and effectively.","breadcrumb":{"@id":"https:\/\/djangostars.com\/blog\/rest-apis-django-development\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/djangostars.com\/blog\/rest-apis-django-development\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/djangostars.com\/blog\/rest-apis-django-development\/#primaryimage","url":"https:\/\/djangostars.com\/blog\/wp-content\/uploads\/2021\/12\/How-to-Develop-APIs-with-Django-REST-Framework.jpg","contentUrl":"https:\/\/djangostars.com\/blog\/wp-content\/uploads\/2021\/12\/How-to-Develop-APIs-with-Django-REST-Framework.jpg","width":1440,"height":620,"caption":"How-to-Develop-APIs-with-Django-REST-Framework"},{"@type":"BreadcrumbList","@id":"https:\/\/djangostars.com\/blog\/rest-apis-django-development\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/djangostars.com\/blog\/"},{"@type":"ListItem","position":2,"name":"How to Develop APIs with Django REST Framework [Step-by-Step Guide]"}]},{"@type":"WebSite","@id":"https:\/\/djangostars.com\/blog\/#website","url":"https:\/\/djangostars.com\/blog\/","name":"Software Development Blog &amp; IT Tech Insights | Django Stars","description":"Welcome behind the scenes of software product development. We share our best practices, tech solutions, management tips, and every useful insight we\u2018ve got while working on our projects.","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/djangostars.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/djangostars.com\/blog\/#\/schema\/person\/f9e65dc651af483f19634c1c0b3fad8e","name":"Oleg Kovalyov","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/djangostars.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/e2c16126d1bbc3288771954718cfcb62e6bcd9db02bd60eaf0b68b05065cdba0?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/e2c16126d1bbc3288771954718cfcb62e6bcd9db02bd60eaf0b68b05065cdba0?s=96&d=mm&r=g","caption":"Oleg Kovalyov"},"sameAs":["https:\/\/www.linkedin.com\/in\/oleg-kovalyov-a43bab103\/"],"url":"https:\/\/djangostars.com\/blog\/author\/oleg-kovalyov\/"}]}},"_links":{"self":[{"href":"https:\/\/djangostars.com\/blog\/wp-json\/wp\/v2\/posts\/1597","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/djangostars.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/djangostars.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/djangostars.com\/blog\/wp-json\/wp\/v2\/users\/27"}],"replies":[{"embeddable":true,"href":"https:\/\/djangostars.com\/blog\/wp-json\/wp\/v2\/comments?post=1597"}],"version-history":[{"count":37,"href":"https:\/\/djangostars.com\/blog\/wp-json\/wp\/v2\/posts\/1597\/revisions"}],"predecessor-version":[{"id":9691,"href":"https:\/\/djangostars.com\/blog\/wp-json\/wp\/v2\/posts\/1597\/revisions\/9691"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/djangostars.com\/blog\/wp-json\/wp\/v2\/media\/3538"}],"wp:attachment":[{"href":"https:\/\/djangostars.com\/blog\/wp-json\/wp\/v2\/media?parent=1597"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/djangostars.com\/blog\/wp-json\/wp\/v2\/categories?post=1597"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/djangostars.com\/blog\/wp-json\/wp\/v2\/tags?post=1597"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}