external-api-refit

Configure Refit clients with resilience, error mapping, and logging for external REST APIs.

Updated Feb 1, 2026
One-click install
npx skills add https://github.com/diegoknsk/video-processing-engine-video-management-lambda --skill external-api-refit
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: external-api-refit
Source: https://github.com/diegoknsk/video-processing-engine-video-management-lambda/tree/main/.cursor/skills/external-api-refit
Command: npx skills add https://github.com/diegoknsk/video-processing-engine-video-management-lambda --skill external-api-refit

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Provides a clean, type-safe way to consume external REST APIs in .NET by leveraging Refit, reducing boilerplate and centralizing error handling.

Core Features & Use Cases

  • Refit interfaces for contracts (request/response) as records with JsonPropertyName attributes
  • Resilience via AddStandardResilienceHandler() to enable retry, circuit breaker, and timeouts
  • Map ApiException to domain exceptions to avoid leaking implementation details
  • Logging of external calls (start, success, error with status code)
  • Dependency injection wiring and a typical service wrapper implementing a Port

Quick Start

Configure a Refit client with AddStandardResilienceHandler, implement a wrapper service that maps ApiException to domain exceptions, and register it in DI.

Frequently Asked Questions about external-api-refit

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

FAQPage Schema
How do I consume external REST APIs in .NET without leaking implementation details?

You can consume external REST APIs by defining Refit interfaces for contracts and mapping ApiException responses to domain exceptions. This approach centralizes error handling and prevents external implementation details from leaking into your domain layer.

How do I add resilience to Refit HTTP clients for retry and circuit breaker patterns?

You add resilience to Refit HTTP clients by configuring AddStandardResilienceHandler() during dependency injection wiring. This enables retry, circuit breaker, and timeout policies automatically for your external API integration layer.

What is the best way to map Refit ApiException to domain exceptions?

The best way to map Refit ApiException to domain exceptions is implementing a service wrapper that catches API errors and translates them. This prevents leaking external API status codes and implementation details into your internal domain logic.

Does this external API integration approach require any specific NuGet packages or dependencies?

This external API integration approach requires Refit for type-safe REST contracts and resilience HTTP handlers. It also relies on .NET dependency injection wiring to register the client and wrapper services properly.

Can I use Refit with standard .NET dependency injection and logging?

Yes, you can use Refit with standard .NET dependency injection and logging. The integration layer wires clients via DI and logs external calls including start, success, and error states with HTTP status codes.

Why do my Refit API calls fail silently without proper error logging?

Refit API calls fail silently when error handling isn't centralized. This Skill provides logging of external calls capturing start, success, and error states with status codes, alongside mapping ApiException to domain exceptions for visibility.