Working with APIs for Frontend Developers
Working with APIs is how a frontend talks to servers. REST clients call resource URLs with HTTP methods, GraphQL clients send queries that name the fields they need, and WebSockets or server-sent events push live updates. Authentication in the browser uses tokens or session cookies to prove who the user is.
Stage: Production and Modern Platform · Part of the Frontend Developer roadmap · Last reviewed 19 November 2026
What to learn in Working with APIs
- Call a REST endpoint with fetch and handle errors and timeouts
- Write a GraphQL query and compare it with several REST calls
- Open a WebSocket connection and update the UI from messages
- Store auth tokens safely and refresh them when they expire
- Handle CORS errors by understanding the preflight request
Working with APIs interview questions
What is the difference between REST and GraphQL for a frontend?
REST exposes many fixed endpoints, which can mean over-fetching or several round trips. GraphQL uses one endpoint where the client asks for exactly the fields it needs. GraphQL adds schema tooling but also caching and query-cost complexity.
Where should a browser app store an access token?
An HttpOnly, Secure, SameSite cookie is safest because scripts cannot read it, limiting damage from XSS. Tokens in localStorage are readable by any injected script. A short-lived in-memory token with a cookie-based refresh is a common compromise.
Where Working with APIs fits in the Frontend Developer roadmap
Working with APIs belongs to the Production and Modern Platform stage (intermediate level), which takes about 5 hours. APIs, auth, deployment and the newer browser capabilities.
Other units in this stage
Back to the full Frontend Developer roadmap