CurlDotNet Documentation Overview: Every Section for curl in C#
This page is the map of the CurlDotNet documentation for running curl commands in C#: where to start, where the API is described, and where to look when something fails. The full site with search is at https://jacob-mellor.github.io/curl-dot-net/ and every page is also readable as Markdown on GitHub.
Getting Started
- Installation - Add the NuGet package and verify it
- Quick Start - First request in a few minutes
- First Request - A complete request and response, explained
- Configuration - Opt-in default timeouts, redirects, User-Agent and TLS settings
Core Concepts
- What is .NET? - For developers new to .NET
- What is curl? - curl basics
- Async Programming - async/await as used by CurlDotNet
- Understanding Results -
CurlResult: status code, headers, body
API Documentation
- API Guide - String API (
Curl.ExecuteAsync), builder API (CurlRequestBuilder), instance API (LibCurl) - Generated API Reference - Types and members generated from the XML comments
- libcurl Mapping - libcurl options and return codes mapped to C#
- curl CLI Compatibility - Which curl flags are supported
- curl Exit Codes - Every curl exit code and the exception CurlDotNet throws for it
- curl Test Suite - How CurlDotNet is checked against curl’s own test files
Practical Examples
- Cookbook - Ready-to-use recipes
- Simple GET Request
- POST JSON Data
- Upload a File
- Download a File
- Handle Errors
- Retries - curl
--retryin C# - Write-out - curl
-wvariables - Multiple URLs and Globbing
- Config Files and Variables -
-K,--variableand.netrc
Authentication
- Authentication Basics - Basic, bearer, Digest and NTLM auth, and
.netrc - Call an API with Auth - Bearer tokens and API keys
Migration Guides
Troubleshooting
- Common Issues
- Error Reference - Exception types and what causes them
- FAQ
- Exception Pages - One page per exception family
Quick Code Examples
Run a curl command string
using CurlDotNet;
var result = await Curl.ExecuteAsync("curl https://api.github.com");
Console.WriteLine(result.StatusCode);
Console.WriteLine(result.Body);
POST JSON
using CurlDotNet;
var result = await Curl.ExecuteAsync(@"curl -X POST https://httpbin.org/post \
-H 'Content-Type: application/json' \
-d '{""name"":""Ada"",""email"":""ada@example.com""}'");
Console.WriteLine(result.IsSuccess);
Builder API
using CurlDotNet.Core;
var result = await CurlRequestBuilder.Get("https://api.github.com/user")
.WithBearerToken("your-token")
.ExecuteAsync();
Console.WriteLine(result.StatusCode);
Quick Navigation
| I want to… | Go to… |
|---|---|
| Install CurlDotNet | Installation |
| Learn the basics | Tutorials |
| See code examples | Cookbook |
| Read API docs | API Guide |
| Solve a problem | Common Issues |
| Migrate from HttpClient | Migration Guide |
| Check runtime support | Framework Compatibility |
Contributing
Found an issue in the documentation or want to add an example?
Links
- Documentation site: https://jacob-mellor.github.io/curl-dot-net/
- NuGet package: https://www.nuget.org/packages/CurlDotNet/
- GitHub repository: https://github.com/jacob-mellor/curl-dot-net