11 APIs

This chapter covers

  • Adding API capabilities to your Django project
  • REST API interfaces
  • Using Django Ninja to build APIs

Adding an API to your project creates a way for other systems to access your data, including alternate frontend interfaces, such as mobile devices and single-page applications (SPAs). The most common API protocol on the web is REST, a mechanism built on top of URLs and HTTP calls. The third-party library Django Ninja allows you to build REST-based APIs using the same view functions you’ve used for your pages.

11.1 Why use an API?

When you think about a web-based software system, your first inclination is that your users are people. You shouldn’t forget the people; they’re definitely your primary audience, ...

Get Django in Action now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.