Welcome to Calling Web APIs With fetch! Fetch a URL, get JSON, use it: that recipe works until a request fails, and then it can’t tell you why. This course shows what travels over the wire, and what to do when it goes wrong.
Long Weekends Abroad
Throughout the course, you’ll build a planner for four friends abroad. Amara lives in Lisbon, Jonas in Berlin, Keiko in Osaka, and Mateo in Mexico City. Two real APIs, Nager.Date and the World Bank, give your planner each country’s public holidays and its name and capital city. Then it lists the long weekends that two or more friends share.
Its code is in the final code of the course summary and in the code download. Here’s what the planner printed on November 27, 2026, against the live APIs (the finished version also adds a deadline and a retry, which don’t change this output):
$ node plan.mjs 2026
Long weekends in 2026 that two or more of you share:
2026-05-01 to 2026-05-03
Amara: Portugal, Lisbon
Jonas: Germany, Berlin
Mateo: Mexico, Mexico City
2026-12-25 to 2026-12-27
Amara: Portugal, Lisbon
Jonas: Germany, Berlin
Mateo: Mexico, Mexico City
Keiko isn’t listed because a weekend counts as shared only when it starts and ends on the same days, and Japan’s long weekends in 2026 start and end on other days.
What You’ll Learn
By the end of this course, you’ll know how to:
- Read the HTTP requests and responses that travel over the wire
- Make and inspect HTTP requests with fetch
- Read an API’s docs, and combine data from real web APIs
- Handle failed requests, slow responses and missing data
- Build a long weekend planner for four friends abroad
Before You Start
This is the last course in the Async JavaScript and Web APIs learning path, and it stands on its own. You can start here if you know async functions with await, and how to run them together with Promise.all() and Promise.allSettled(), catch their errors and time them out with AbortController. You also need JSON and ES modules.
If you’d like a refresher, then these RealJS courses cover them:
- Promises and async/await, the second course in this path
- Concurrency, Failures and Cancellation in Async Code, the third course in this path
- Modules and JSON: Programs Across Files
- When Things Go Wrong: Errors and Debugging
For tools, you need a terminal, a current version of Node.js, and any editor. The examples use Node.js 26:
$ node --version
v26.13.1
How the Course Works
The course mixes text lessons and videos. Each of the first three sections ends with a coding exercise in your browser. The project gives you a brief and its checks, without a walkthrough. Then an AI mentor reviews your planner, and you build a small program of your own. A quiz and a summary close the course. You can download the sample code (.zip) and the slides (.pdf).
The next lesson is Read a Raw HTTP Exchange. It asks what really travels when a program asks for the holidays in Amara’s Portugal.