Fetch: GET, POST, PUT and DELETE
Learn Fetch: GET, POST, PUT and DELETE (Phase 9 · Fetch API and REST Integration (Essential), JavaScript) with worked examples, diagrams and interview questions. Free on JavaSchoolLab.
Talking to a REST API • fetch(url, options) returns a promise of a Response . Read the body with response.json() , .text() or .blob() (each is itself a promise). • REST maps HTTP verbs to actions: GET read, POST create, PUT/PATCH update, DELETE remove. Status codes tell the result: 200 OK, 201 Created, 204 No Content, 400 Bad Request, 401/403 auth, 404 Not Found, 500 server error.