DHL Parcel DE Shipping API v2 client for Parcel.NET.
$ dotnet add package Parcel.NET.Dhl.ShippingDHL Parcel DE Shipping API v2 client for Parcel.NET — create, validate, and cancel shipments, and create daily closing manifests.
dotnet add package Parcel.NET.Dhl.Shipping
builder.Services.AddDhl(options =>
{
options.ApiKey = "your-api-key";
options.ApiSecret = "your-api-secret";
options.Username = "your-username";
options.Password = "your-password";
})
.AddDhlShipping();
// Resolve the client
var client = serviceProvider.GetRequiredService<IDhlShippingClient>();
// Validate a shipment
var validation = await client.ValidateShipmentAsync(request);
// Create a shipment
var response = await client.CreateShipmentAsync(request);
Console.WriteLine($"Shipment: {response.ShipmentNumber}");
// Create daily closing manifest
var manifest = await client.CreateManifestAsync();
// Cancel a shipment
await client.CancelShipmentAsync(response.ShipmentNumber);
IDhlShippingClient extends IShipmentService, so you can also resolve it via the carrier-agnostic interface.