Skip to the content.

CurlDotNet Cookbook

Welcome to the CurlDotNet Cookbook! This collection of practical recipes shows you how to accomplish common tasks using CurlDotNet.

What is CurlDotNet?

CurlDotNet is the pure .NET implementation of curl that allows you to execute curl commands directly in C# applications. Simply paste any curl command from documentation, Stack Overflow, or bash scripts, and it works immediately!

Installation

Install CurlDotNet from NuGet: CurlDotNet on NuGet

dotnet add package CurlDotNet

Or via Package Manager:

Install-Package CurlDotNet

Recipe Categories

🍳 Beginner Recipes

Perfect for getting started with CurlDotNet:

🥘 Intermediate Recipes (Coming Soon)

Take your skills to the next level:

🍱 Advanced Patterns (Coming Soon)

Master complex scenarios:

🌍 Real World Examples (Coming Soon)

Complete implementations for popular services:

Quick Examples

Simple GET Request

using CurlDotNet;

var result = await Curl.ExecuteAsync("curl https://api.github.com");
Console.WriteLine(result.Body);

POST with JSON

using CurlDotNet;

var json = "{\"name\":\"John\",\"email\":\"john@example.com\"}";
var result = await Curl.ExecuteAsync($@"
    curl -X POST https://api.example.com/users \
      -H 'Content-Type: application/json' \
      -d '{json}'
");

if (result.IsSuccess)
{
    Console.WriteLine("User created successfully!");
}

Download a File

using CurlDotNet;

var result = await Curl.ExecuteAsync(@"
    curl -o downloaded.pdf https://example.com/file.pdf
");

if (result.IsSuccess)
{
    Console.WriteLine("File downloaded successfully!");
}

How to Use These Recipes

Each recipe in this cookbook:

  1. Explains the problem it solves
  2. Shows complete, working code you can copy and paste
  3. Includes error handling and best practices
  4. Provides variations for different scenarios
  5. Links to related recipes for deeper learning

Recipe Structure

Every recipe follows this format:

Finding the Right Recipe

By Task

By HTTP Method

By Feature

Contributing Recipes

We welcome recipe contributions! If you have a useful pattern or example:

  1. Fork the repository
  2. Add your recipe following our format
  3. Submit a pull request

Additional Resources

Support


Ready to cook? Start with a Simple GET Request