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












