0Pricing
Django Academy · Lesson

The Browsable API and Status Codes

Test endpoints in the browser correctly.

The Browsable API and Status Codes is a free Django Academy lesson on CoddyKit — lesson 4 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Django Academy learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.

Test in the Browser

DRF's browsable API renders any endpoint as an interactive web page, so you can explore and test your API without extra tools. 🌐

How It Decides

DRF uses content negotiation: browsers ask for HTML and get the friendly page, while code asking for JSON gets raw JSON instead.

Forms for Free

For write endpoints the browsable API even shows a form, letting you POST test data with a click instead of crafting curl commands.

Force JSON Anytime

Append ?format=json to any URL to skip the HTML page and see the exact JSON a real client would receive.

GET /api/books/?format=json

Status Codes Matter

Every API response carries an HTTP status code that tells the client what happened, far more reliably than reading the body text.

200 and 201

200 means a successful read, while 201 Created signals that a POST actually made a new resource, a small but important distinction.

Readable Constants

Instead of magic numbers, DRF gives you named constants in status so your code reads clearly and avoids typos like 20 versus 200.

from rest_framework import status
status.HTTP_201_CREATED

Client Errors: 400 and 404

The 4xx range blames the request: 400 means bad input that failed validation, and 404 means the resource simply was not found.

Response(serializer.errors, status=400)

Server Errors: 500

A 500 means your code crashed, not the client. These signal bugs to fix, never something the caller did wrong.

Match Code to Outcome

Good APIs are predictable: return 201 on create, 400 on invalid input, 404 when missing. Correct status codes make clients trust you.

Browsable Plus Status

Together the browsable API and clear status codes make DRF endpoints easy to test by hand and easy for clients to consume.

Quick Check

Which status code best fits a successful POST that creates a record?

Recap: Test and Respond

You met the browsable API for hands-on testing and learned to return honest status codes like 200, 201, 400, and 404. ✅

Frequently asked questions

Is the “The Browsable API and Status Codes” lesson free?

Yes — the full text of “The Browsable API and Status Codes” is free to read here on the web, and the Django Academy course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Django Academy course, upgrade to CoddyKit PRO.

What will I learn in “The Browsable API and Status Codes”?

Test endpoints in the browser correctly. You practise Django Academy with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.

Do I need any experience to start Django Academy?

No prior experience is required. Django Academy on CoddyKit is structured for beginners through advanced learners; this is — lesson 4 of 4, so you can start here or from the beginning and move at your own pace.

How long does the “The Browsable API and Status Codes” lesson take?

Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.

Can I write and run code in this Django Academy lesson?

Yes. Every Django Academy lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.

All lessons in this course

  1. Installing and Configuring DRF
  2. Serializers: Model to JSON
  3. APIView and Function @api_view
  4. The Browsable API and Status Codes
← Back to Django Academy