An API is a defined interface that lets software systems access a project’s data and logic without connecting directly to its database. It can support mobile applications, single-page applications, other computers, and traditional web pages. section 11.1 section 1.2.1
A REST-style API commonly organizes data and actions around:
- URLs that identify resources, treated as the system’s nouns. section 11.5
- HTTP methods that act as verbs: GET fetches, POST creates or modifies, PUT and PATCH update, and DELETE removes. section 11.5
- Payloads commonly formatted as JSON or XML; clients need to know both the method and payload format. section 11.5
In Django, an API endpoint is a view that inspects the HTTP method and performs the requested action. Django Ninja reduces the plumbing: decorators turn view functions into endpoints, Schema objects translate JSON, and ModelSchema can derive a schema from a Django model. A central NinjaAPI object registers routes, while routers group related endpoints. section 11.1.2 section 11.5
Versioning a breaking change
Suppose an API removes an object or adds a required field. Put a new version number in the URL, maintain the older URL for a while, and let existing clients migrate without breaking. section 11.1.2
Figure 11.1 Mixing web and API interfaces allows Django to be a backend for multiple types of devices
Compare how one Django backend can serve server-rendered pages, mobile applications, and JavaScript single-page interfaces. section 11.1











































