CurlDotNet API Reference
Welcome to the CurlDotNet API documentation. This reference contains detailed information about all public types and members in CurlDotNet.
Main Entry Points
Curl Class
The primary class for executing curl commands. Provides static methods for executing curl commands directly.
var response = await Curl.ExecuteAsync("curl https://api.github.com");
DotNetCurl Class
Alternative entry point that provides a more .NET-style API while maintaining curl compatibility.
Core Namespace
CurlDotNet.Core
Core functionality including:
- CurlResult - Response object containing headers, body, and status
- CurlOptions - Configuration options for curl requests
- CurlRequestBuilder - Fluent API for building curl requests
- CurlSettings - Global settings for curl operations
Exception Handling
CurlDotNet.Exceptions
Comprehensive exception types for all curl error codes:
- CurlException - Base exception for all curl errors
- CurlHttpException - HTTP-specific errors with status codes
- CurlTimeoutException - Timeout-related errors
- CurlSslException - SSL/TLS certificate errors
- And 90+ more specific exception types
Middleware
CurlDotNet.Middleware
Extensible middleware pipeline for request/response processing:
- ICurlMiddleware - Interface for custom middleware
- CurlMiddlewarePipeline - Pipeline management
- BuiltInMiddleware - Pre-built middleware components
Quick Examples
Simple GET Request
var result = await Curl.ExecuteAsync("curl https://api.example.com/data");
Console.WriteLine(result.Body);
POST with JSON
var result = await Curl.ExecuteAsync(@"
curl -X POST https://api.example.com/users \
-H 'Content-Type: application/json' \
-d '{""name"":""John"",""email"":""john@example.com""}'
");
With Authentication
var result = await Curl.ExecuteAsync(@"
curl -u username:password https://api.example.com/protected
");