Roster API Desk
GET list, POST create, PUT update, DELETE — against JSONPlaceholder.
Capstone: practice all four methods with async/await,
response.ok checks, and JSON bodies. Writes are fake-persisted
by JSONPlaceholder (echoes look real). Needs network access.
Idle
Action results appear here.
Important JavaScript
async function apiJson(url, options) {
const response = await fetch(url, options);
if (!response.ok) {
throw new Error("HTTP " + response.status);
}
if (options && options.method === "DELETE") {
return null;
}
return response.json();
}