A weather app doesn't know the forecast itself — it phones a distant server (an API) and asks. Talking to APIs is how apps fetch fresh data, so your screen shows today's weather, not last week's.
Apps rarely work alone
An API (application programming interface) is a contract for talking to a server: send a request, get a response, usually as JSON. Because the network takes time and can fail, a good app shows a loading state while it waits and an error state if the request fails.
Every network call has three outcomes to design for: loading, success (show the data), and error (show a retry). Forgetting the error state is the most common bug.
- An app fetches a list of messages from an API.
- What should the screen show while waiting?
- What should it show if the request fails?
What you should see: Show a spinner while loading, the messages on success, and a friendly 'Couldn't load — retry' on error. All three states must be handled.