← All short lessons

Technology · Go deeper · Debugging

Handle an API that returns a page

Separate a sign-in redirect, a service error and valid data.

Start or resume with saved notes →
7–10 min for the lesson · application takes longer

Situation

Build it. Try it. Change one thing.What would you test when the easy example works?Illustrated learning characters · fictional scene

The Builder · fictional example

The situation

A save button calls response.json(). The response begins with '<!DOCTYPE html>' because the request reached a sign-in page. The user sees an unreadable JSON error and cannot tell whether work saved.

Before you continue

What would you predict? Say it aloud or write a line on paper. Then compare your reasoning with the example.

Starting knowledge: Understand a request, a response status and JSON.

Need a hint or a clearer next step?

Work through Handle an API that returns a page with a focused prompt. Your notes stay private unless you choose to paste an excerpt here.

Use fictional examples. Leave out names, contact details, passwords and private records.

Get an answer here with my own OpenAI API key

Requires an active learning profile. Your provider may charge you; API billing is separate from ChatGPT. EaseBrain has no paid-key fallback.

Key clears after each attempt. EaseBrain saves only a daily request count, not your key, prompt or answer. OpenAI’s data policies apply. Up to 500 output tokens and 20 attempts a day; no automatic retries. These limits do not guarantee a spending ceiling.

Sign in · Complete my learning profile

Preview notes stay in this page only. Download before leaving.

Keep your work for later

Download a lesson backup, then open the saved workspace and restore it there. Preview work is not stored in this browser after you leave.