Build a REST API in 30 minutes with Django REST Framework

Bennett Garner
The Startup
Published in
12 min readMay 17, 2019

--

Building a REST API in Django is so super easy. In this tutorial, we’ll walk through the steps to get your first API up and running.

(This post is part of a series where I teach how to deploy a React front end on a Django back end. However, nothing in this post is React specific. Whatever your API needs, read on!)

[Just want to see some source code? My pleasure: https://github.com/bennett39/drf_tutorial]

Why REST API?

Before we get to the code, it’s worth considering why you would want to build an API. If someone had explained these basic concepts to me before I started, I would have been so much better off.

A REST API is a standardized way to provide data to other applications. Those applications can then use the data however they want. Sometimes, APIs also offer a way for other applications to make changes to the data.

There are a few key options for a REST API request:

  • GET — The most common option, returns some data from the API based on the endpoint you visit and any parameters you provide
  • POST — Creates a new record that gets appended to the database
  • PATCH — Update individual fields of an existing record

--

--

Bennett Garner
The Startup

DeveloperPurpose.com — Build a coding career with meaning and purpose 💻 Top writer in technology ✍️