maui-rest-api

Configures HttpClient with DI wiring and camelCase JSON for .NET MAUI REST API integrations.

Updated Dec 25, 2025
One-click install
npx skills add https://github.com/heldercsousa/MyVocaList --skill maui-rest-api-heldercsousa
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: maui-rest-api
Source: https://github.com/heldercsousa/MyVocaList/tree/main/.claude/skills/maui-rest-api
Command: npx skills add https://github.com/heldercsousa/MyVocaList --skill maui-rest-api-heldercsousa

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Guidance for developers building .NET MAUI apps who need to consume REST APIs, providing patterns for HttpClient usage, DI wiring, and a clean service layer.

Core Features & Use Cases

  • HttpClient setup & JSON options: Configure a shared JsonSerializerOptions with camelCase and register HttpClient via DI.
  • Service interface + implementation: Define and implement API services with a clean interface and injectable HttpClient.
  • CRUD operations: Provide asynchronous CRUD methods for common resources.
  • Error handling & platform tweaks: Include robust error handling and platform-specific adjustments for local development.

Quick Start

Register your API service in MauiProgram and call IMyApiService methods from your view models.

Frequently Asked Questions about maui-rest-api

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I consume a REST API in .NET MAUI using HttpClient and dependency injection?

To consume a REST API in .NET MAUI, you register HttpClient via dependency injection (DI) in MauiProgram, define a clean service interface, and implement asynchronous CRUD methods using a shared JsonSerializerOptions configured for camelCase JSON serialization.

What's the best way to structure a reusable service layer for CRUD operations in MAUI?

The best way to structure a reusable service layer in MAUI is by defining a service interface and implementing it with an injectable HttpClient, ensuring asynchronous CRUD methods and robust error handling are encapsulated away from your view models.

How do I configure camelCase JSON serialization for HttpClient in a MAUI app?

To configure camelCase JSON serialization in a MAUI app, you set up a shared JsonSerializerOptions with PropertyNamingPolicy set to CamelCase, then apply these options to your registered HttpClient instance during DI wiring.

Does .NET MAUI support platform-specific configuration for local development when calling REST APIs?

Yes, .NET MAUI supports platform-specific configuration for local development, allowing you to apply necessary tweaks and adjustments for HttpClient so it can correctly communicate with local remote services during testing.

Why do I need to register HttpClient via DI in a .NET MAUI app instead of instantiating it directly?

Registering HttpClient via DI in a MAUI app is necessary to avoid socket exhaustion and enable proper lifecycle management, allowing your API services to cleanly inject the client and apply consistent JSON options and error handling.