You can't do it through USPS. They use SOAP/XML for their endpoints with absolutely no client libraries or documentation to support you, but you can use Easypost to connect to USPS today using C#/.NET.
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using EasyPost;
using EasyPost.Models.API;
using EasyPost.Parameters;
using Newtonsoft.Json;
namespace EasyPostExamples
{
public class Examples
{
public static async Task Main()
{
var client = new EasyPost.Client("EASYPOST_API_KEY");
Parcel parcel = await client.Parcel.Create(
new Parameters.Parcel.Create
{
PredefinedPackage = "Parcel",
Weight = 28
}
);
Shipment shipment = await client.Shipment.Create(
new Parameters.Shipment.Create
{
ToAddress = toAddress,
FromAddress = fromAddress,
Parcel = parcel
}
);
await client.shipment.Buy(shipment.Id, shipment.LowestRate());
}
}
}
QALO uses EasyPost's API to automate their returns for an unbeatable customer experience.
With EasyPost's API, Expedited Passports & Visas cut their operational load in half.
Casper sped up their European launch thanks to EasyPost's support of over 30+ European carriers.
Sign up and start shipping in the same day with our .NET Library. If you have any questions, or if you want to talk logistics, feel free to reach out to one of our shipping experts.