Building a GraphQL API with Django

python_tutorials

Introduction

Web APIs are the engines that power most of our applications today. For many years REST has been the dominant architecture for APIs, but in this article we will explore GraphQL.

With REST APIs, you generally create URLs for every object of data that’s accessible. Let’s say we’re building a REST API for movies – we’ll have URLs for the movies themselves, actors, awards, directors, producers… it’s already getting unwieldy! This could mean a lot of requests for one batch of related data. Imagine you were the user of a low powered mobile phone over a slow internet connection, this situation isn’t ideal.

GraphQL is not an API architecture like REST, it’s a language that allows us to share related data in a much easier fashion. We’ll use it to design an API for movies. Afterwards, we’ll look at how the Graphene library enables us to build APIs in Python by making a movie API with Django.

What is GraphQL

Originally created by Facebook but now developed under the GraphQL Foundation, GraphQL is a query language and server runtime that allows us to retrieve and manipulate data.

We leverage GraphQL’s

To finish reading, please visit source site