CurlDotNet Tutorials
CurlDotNet tutorials for beginners: learn curl in C# step by step, from what .NET and curl are through your first Curl.ExecuteAsync request, reading results, JSON, headers, authentication, file downloads, forms, cancellation, parallel requests and debugging. All 14 tutorials are listed below in order.
What is CurlDotNet?
CurlDotNet is a pure .NET implementation of curl. You pass a curl command string to Curl.ExecuteAsync and it runs the request inside your C# application, with no shell and no curl binary required.
Installation
Install from NuGet (CurlDotNet on NuGet):
dotnet add package CurlDotNet
See the installation guide for project setup.
Tutorial Series
Foundation
- What is .NET and C#? - The platform, the language, and your first program
- What is curl? - The curl command-line tool and how its options map to CurlDotNet
- Understanding Async/Await - Why requests are awaited and how to run several at once
Getting Started
- Your First Request - Run
Curl.ExecuteAsyncand read the result - Understanding Results - Working with
CurlResult: status, headers, body - Handling Errors - Status codes,
EnsureSuccess, andCurlExceptiontypes
Working with Data
- JSON for Beginners - Parsing JSON responses with
ParseJson<T> - Headers Explained - Sending and reading HTTP headers
- Authentication Basics - Basic auth, bearer tokens and API keys
Files and Forms
- Files and Downloads - Downloading with
-oand uploading with-F - Forms and Data - Submitting form data and request bodies
Advanced Concepts
- Cancellation Tokens - Stopping requests with
CancellationToken - Parallel Requests -
Task.WhenAllandCurl.ExecuteManyAsync - Debugging Requests - Verbose output, tracing and timings
Learning Path
Complete Beginner?
Start with Tutorial 1 to understand .NET, then work through each tutorial in order.
Know .NET but New to curl?
Jump to Tutorial 2 to understand curl, then move to Tutorial 4 for practical examples.
Experienced Developer?
Go straight to Tutorial 4, or skip the tutorials and use the quickstart and the cookbook.
Quick Example
using CurlDotNet;
var result = await Curl.ExecuteAsync("curl https://api.github.com");
Console.WriteLine(result.StatusCode);
Console.WriteLine(result.Body);
What You’ll Learn
By completing these tutorials you will understand:
- The .NET ecosystem and C# basics
- How curl works and why API documentation uses it
- Asynchronous programming patterns
- Making HTTP requests with CurlDotNet
- Handling responses and errors
- Working with JSON, headers, authentication and files
Additional Resources
- Cookbook - Practical recipes for common tasks
- API guide - The
Curl,CurlRequestBuilderandCurlResultAPIs - Exception reference - Every CurlDotNet exception and how to handle it
- Troubleshooting - Solutions to common issues
- GitHub repository - Source code and examples
Need Help?
- Check the troubleshooting guide and FAQ
- Ask in GitHub Discussions
- Report problems on GitHub Issues
Ready to start? Begin with What is .NET and C#?.