liveBook · Manning

API key

As explained in .NET MAUI in Action

An API key is a credential that identifies or authorizes a client when it accesses a service API.

An API key identifies the MauiMovies app when it requests movie and genre data from The Movie Database API. Obtain the key through an account, then configure it alongside the API base URI. section 6.2.1

Listing 6.7 The updated MainPage.xaml.cs with the fields and properties
using System.Collections.ObjectModel;
using System.Net.Http.Json;
 
namespace MauiMovies;
 
public partial class MainPage : ContentPage
{
    string _apiKey = "[your API key]";
    string _baseUri = "https:/ /api.themoviedb.org/3/";
 
    private TrendingMovies _movieList;
 
    private GenreList _genres;
 
    public ObservableCollection<Genre> Genres { get; set; } = new();
 
    public ObservableCollection<MovieResult> Movies { get; set; } = new ();
 
    public bool IsLoading { get; set; }
 
    private readonly HttpClient _httpClient;
 
    public MainPage()
    {
        InitializeComponent();
    }
}

Inspect the complete field and property setup showing where the API key sits in the page’s request configuration. section 6.2.1

How .NET MAUI in Action covers it

How deep it goes
Shows field declaration and query-string usage in HTTP requests, without detailing broader credential management.
Examples
Uses a The Movie Database key in the MauiMovies app to retrieve trending movies and genres.
What it assumes
Requires an account with the service and a newly created blank .NET MAUI application.
What you can do after
Configure and operate authenticated movie-data requests from a .NET MAUI application.
How it connects
Connects API keys with HTTP clients, REST API requests, JSON deserialization, and .NET MAUI pages.

Also explained in

Compare how 13 books explain API key →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of .NET MAUI in Action. The section links point to the parts of the book it draws on.