DHLSharp.Client 1.0.0-beta

This is a prerelease version of DHLSharp.Client.
dotnet add package DHLSharp.Client --version 1.0.0-beta
                    
NuGet\Install-Package DHLSharp.Client -Version 1.0.0-beta
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="DHLSharp.Client" Version="1.0.0-beta" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="DHLSharp.Client" Version="1.0.0-beta" />
                    
Directory.Packages.props
<PackageReference Include="DHLSharp.Client" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add DHLSharp.Client --version 1.0.0-beta
                    
#r "nuget: DHLSharp.Client, 1.0.0-beta"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#addin nuget:?package=DHLSharp.Client&version=1.0.0-beta&prerelease
                    
Install DHLSharp.Client as a Cake Addin
#tool nuget:?package=DHLSharp.Client&version=1.0.0-beta&prerelease
                    
Install DHLSharp.Client as a Cake Tool

DHLSharp

DHLSharp

DHLSharp is a C# library that provides an interface to the DHL API. It allows you to create and track shipments with DHL from within your .NET applications.

⚠️ This library is in an early stage of development. It has been validated only for the German (DE) market so far.

Features

  • 📦 Create shipments programmatically via the DHL API
  • 🔍 Track existing shipments using tracking numbers
  • 💡 Simple and fluent interface for integration in .NET projects
  • 🇩🇪 Currently tested and validated for use in Germany

Installation

Coming soon to NuGet!

For now, clone the repository and reference the project or compile it into your solution manually.

git clone https://github.com/stephanstapel/DHLSharp.git

Getting Started

Create a Shipment

DHLClient client = new DHLClient(myConfiguration);
Shipment[] shipments = new[]
    {
    new Shipment
    {
        Product = ProductType.NationalPackage,         
        RefNo = "Order No. 1234",
        ShipDate = DateTime.Today,
        Shipper = new Shipper
        {
            Name1 = "My Online Shop GmbH",
            AddressStreet = "Sträßchensweg 10",
            PostalCode = "53113",
            City = "Bonn",
            Country = CountryCode.Germany,
            Email = "max@mustermann.de",
            Phone = "+49 123456789"
        },
        Consignee = new Consignee
        {
            Name = "Maria Musterfrau",
            PostNumber = "12345678",
            RetailID = "502",
            PostalCode = "53113",
            City = "Bonn",
            Country = CountryCode.Germany
        },
        Details = new Details
        {
            Dimensions = new Dimensions
            {
                Uom = "mm",
                Height = 100,
                Length = 200,
                Width = 150
            },
            Weight = new Weight
            {
                Uom = "g",
                Value = 500
            }
        }
    }
};
var result = await client.CreateShipmentAsync("STANDARD_GRUPPENPROFIL", shipments, validate: false);

Track a Shipment

var trackingData = await api.TrackShipmentAsync("<parcelid>", "de"); // "de": optional parameter allows to specify output language

Credential handling in the demo application

The component comes with a demo application which showcases the functionality of the component.

⚠️ The file credentials.json is not part of the public repository.
Copy credentials.template.json into credentials.json and add the missing information. Alternatively, you can of course fill the DHLClientConfig structure manually.

Limitations

  • Only tested for Germany (DE) so far.
  • Not production-ready for other DHL regions or products.
  • Requires manual setup (e.g. credentials, integration logic).

Contributing

Contributions are welcome! If you find issues or want to improve functionality, feel free to open a pull request or create an issue. License

This project is licensed under the Apache 2.0 License.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net8.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.0-beta 125 4/1/2025

1.0.0-beta: Initial release. Lots of things are still subject to change.
Feedback welcome!