A weather app needs a forecast, but its team does not produce its own weather observations and forecast models. It can request data from a service that does.
The two programs need an agreed way to ask for information and interpret the reply. That agreement lets the weather service change its internal systems without every app needing direct access to them.