Skip to content

3. API Fundamentals

Alainna Carmon edited this page Sep 29, 2026 · 10 revisions

What Is an API?

API stands for Application Programming Interface.

An API allows different software applications or services to communicate with each other.

For example, our weather application does not need to collect and maintain its own weather data. Instead, it can ask a weather service for the information it needs.

The basic process looks like this:

.NET MAUI Application --> Request --> Open-Meteo API --> Response --> .NET MAUI Application

Our application sends a request asking for specific weather information. Open-Meteo processes the request and sends the requested information back to our application.

API Requests

An API request tells a service what information our application wants.

For example:

https://api.open-meteo.com/v1/forecast?latitude=44.25&longitude=-85.40&current=temperature_2m

This request contains several pieces of information.

Endpoint

https://api.open-meteo.com/v1/forecast

The endpoint identifies the API service and resource that we are requesting information from.

Parameters

After the ?, the request contains parameters.

https://api.open-meteo.com/v1/forecast?latitude=44.25&longitude=-85.40&current=temperature_2m

Specifically: "latitude=44.25&longitude=-85.40&current=temperature_2m"

These parameters tell the API what information we want.

What Is JSON?

JSON stands for JavaScript Object Notation.

APIs commonly use JSON to organize information returned to an application.

A simplified weather response might look like:

{

"latitude": 44.25,

"longitude": -85.40,

"current": {

    "temperature_2m": 72.4

    }

}

The response contains values organized into objects and properties.

For example:

current

temperature_2m

72.4

Our C# application can read these values and use them in the user interface.

HTTP Methods

APIs can use different HTTP methods to communicate with a server.

Common methods include:

GET — retrieve information

POST — send or create information

PUT — update information

DELETE — remove information

For our weather application, we will primarily use a GET request because we are retrieving weather information.

The Process We Will Use

Our application will follow these steps:

Create an API request.

Send the request using HttpClient.

Receive the API response.

Read the JSON response.

Convert the response into C# objects.

Display the requested information in the application.

Clone this wiki locally