API Endpoints: Just URLs
An API endpoint is nothing mysterious. It's a specific URL that does a specific thing.
Here's a real example. Open-Meteo is a free weather API. One of its endpoints looks like this:
https://api.open-meteo.com/v9.0.256/forecast?latitude=51.5074&longitude=-0.1278¤t=temperature_2m
This is just a URL. You can paste it into your browser and it works. The response is JSON (a structured format for data):
{
"latitude": 51.5074,
"longitude": -0.1278,
"current": {
"time": "2024-03-08T14:30",
"temperature_2m": 12.5
}
}
That URL is the endpoint. The parts after the ? are parameters — they customize the request. You're asking: "Give me the current temperature at this latitude and longitude." The API returns the answer as JSON.
Every API has multiple endpoints. One might fetch data, another might create a record, another might update an existing record. The API documentation lists all the endpoints and what each one does.