LabelInn 2.0.1
See the version list below for details.
dotnet add package LabelInn --version 2.0.1
NuGet\Install-Package LabelInn -Version 2.0.1
<PackageReference Include="LabelInn" Version="2.0.1" />
<PackageVersion Include="LabelInn" Version="2.0.1" />
<PackageReference Include="LabelInn" />
paket add LabelInn --version 2.0.1
#r "nuget: LabelInn, 2.0.1"
#:package LabelInn@2.0.1
#addin nuget:?package=LabelInn&version=2.0.1
#tool nuget:?package=LabelInn&version=2.0.1
LabelInn C# SDK
Official .NET client for the LabelInn Cloud Print API. Send labels to thermal printers (Zebra, TSC, Honeywell), manage your fleet, and build print automation workflows — all from C#.
Zero external dependencies. Uses built-in HttpClient and System.Net.Http.Json.
Table of Contents
- Installation
- Quick Start
- Authentication
- Print Jobs
- Fleet Management
- Designs (Templates)
- Webhooks
- Data Connect
- Error Handling
- Configuration
Installation
dotnet add package LabelInn
Requires .NET 6.0 or later.
Quick Start
using LabelInn;
// Initialize client
var client = new LabelInnClient("sk_live_your_key_here");
// Print from a template
var job = await client.PrintJobs.CreateAsync(new PrintJobRequest
{
PrinterId = "prt_abc123",
PayloadType = "template",
DesignId = "tmpl_shipping",
Data = new Dictionary<string, string>
{
["name"] = "Jane Doe",
["order"] = "ORD-4521",
["barcode"] = "TR123456789"
},
Copies = 2
});
Console.WriteLine($"Job {job.Id} → {job.Status}");
Authentication
Get your API key from LabelInn → Settings → API Keys.
// Test mode (sandbox — no real prints)
var dev = new LabelInnClient("sk_test_xxxxx");
// Live mode (sends to physical printers)
var prod = new LabelInnClient("sk_live_xxxxx");
// Custom base URL
var custom = new LabelInnClient("sk_live_xxxxx", "https://custom.api.example.com/v1");
Print Jobs
Send ZPL (raw printer code)
var job = await client.PrintJobs.CreateAsync(new PrintJobRequest
{
PrinterId = "prt_abc123",
PayloadType = "zpl",
PayloadData = "^XA^FO50,50^ADN,36,20^FDShipping Label^FS^XZ"
});
Send an image
var job = await client.PrintJobs.CreateAsync(new PrintJobRequest
{
PrinterId = "prt_abc123",
PayloadType = "image",
ImageUrl = "https://example.com/labels/shipping.png"
});
Print from a template with data
var job = await client.PrintJobs.CreateAsync(new PrintJobRequest
{
PrinterId = "prt_abc123",
PayloadType = "template",
DesignId = "tmpl_shipping_v2",
Data = new
{
order_id = "ORD-9876",
customer = "Ali Yilmaz",
barcode = "TR123456789"
}
});
Idempotency (prevent duplicate prints)
var job = await client.PrintJobs.CreateAsync(
new PrintJobRequest { ... },
idempotencyKey: "order-9876-label"
);
// Calling again with the same key returns the original job
List & manage jobs
// List recent jobs
var list = await client.PrintJobs.ListAsync(new PrintJobListQuery { Limit = 10 });
// Filter by status
var failed = await client.PrintJobs.ListAsync(new PrintJobListQuery { Status = "failed" });
// Get job details
var job = await client.PrintJobs.GetAsync("job_abc123");
// Cancel a queued job
await client.PrintJobs.CancelAsync("job_abc123");
// Reprint with different printer
await client.PrintJobs.ReprintAsync("job_abc123", new ReprintRequest
{
PrinterId = "prt_backup"
});
Fleet Management
// List all printers
var printers = await client.Fleet.ListAsync();
// Filter by status
var online = await client.Fleet.ListAsync(new PrinterListQuery { Status = "online" });
// Get printer details
var printer = await client.Fleet.GetAsync("prt_abc123");
// Quick status check
var status = await client.Fleet.StatusAsync("prt_abc123");
Console.WriteLine($"{status.Status} — Paper: {status.PaperStatus}");
Designs (Templates)
// List all designs
var designs = await client.Designs.ListAsync();
// Get design details
var design = await client.Designs.GetAsync("tmpl_shipping");
// Get template variables
var vars = await client.Designs.VariablesAsync("tmpl_shipping");
Console.WriteLine($"Variables: {string.Join(", ", vars.Variables)}");
// Clone a design
var clone = await client.Designs.CloneAsync("tmpl_shipping", new CloneDesignRequest
{
Name = "Shipping v2"
});
// Render a preview
var preview = await client.Designs.RenderAsync("tmpl_shipping", new RenderDesignRequest
{
Data = new { customer_name = "John" }
});
Console.WriteLine($"Preview: {preview.ImageUrl}");
// Create a new design
var newDesign = await client.Designs.CreateAsync(new CreateDesignRequest
{
Name = "Custom Label",
WidthMm = 100,
HeightMm = 50
});
Webhooks
// List webhooks
var webhooks = await client.Webhooks.ListAsync();
// Create a webhook
var wh = await client.Webhooks.CreateAsync(new CreateWebhookRequest
{
Url = "https://example.com/webhooks/labelinn",
Events = new[] { "print.job.completed", "print.job.failed" }
});
Console.WriteLine($"Secret (save this): {wh.SigningSecret}");
// Update webhook
await client.Webhooks.UpdateAsync(wh.Id, new UpdateWebhookRequest
{
Enabled = true,
Events = new[] { "print.job.completed" }
});
// Send test event
var test = await client.Webhooks.TestAsync(wh.Id);
// Get delivery history
var deliveries = await client.Webhooks.DeliveriesAsync(wh.Id, limit: 50);
// Delete webhook
await client.Webhooks.DeleteAsync(wh.Id);
Data Connect
Data Connect lets you ingest data from any enterprise system (SAP, Oracle, CSV, JSON) and print labels. Supports XML/IDoc, CSV/TSV, and JSON/NDJSON with auto-detection.
Ingest Data
var result = await client.Connect.IngestAsync(new ConnectIngestRequest
{
SourceId = "src_abc123",
Payload = "[{\"sku\": \"A001\"}, {\"sku\": \"A002\"}]",
Format = "json"
});
Console.WriteLine($"Ingested {result.RecordsCount} records");
Test Parse
var parsed = await client.Connect.TestParseAsync(new ConnectTestParseRequest
{
Payload = csvString,
Format = "csv"
});
foreach (var field in parsed.Schema)
Console.WriteLine($"{field.Path} ({field.Type}): {field.Sample}");
Manage Sources
// Create
var source = await client.Connect.CreateSourceAsync(new CreateSourceRequest
{
Name = "SAP Orders",
Format = "xml"
});
// List
var sources = await client.Connect.ListSourcesAsync();
// Get / Update / Delete
var detail = await client.Connect.GetSourceAsync("src_abc123");
await client.Connect.UpdateSourceAsync("src_abc123", new UpdateSourceRequest { Name = "SAP v2" });
await client.Connect.DeleteSourceAsync("src_abc123");
Schema, Records & Mappings
var schema = await client.Connect.GetSchemaAsync("src_abc123");
var records = await client.Connect.ListRecordsAsync("src_abc123", limit: 50);
var mappings = await client.Connect.GetMappingsAsync("src_abc123");
await client.Connect.UpdateMappingsAsync("src_abc123", new { sku = "product_code" });
Print from Connector
var printResult = await client.Connect.PrintAsync(new ConnectPrintRequest
{
SourceId = "src_abc123",
DesignId = "dsg_shipping",
PrinterId = "prt_warehouse1",
Copies = 1
});
Console.WriteLine($"Created {printResult.Count} print jobs");
Error Handling
try
{
var job = await client.Print.GetAsync("job_abc123");
}
catch (LabelInnRateLimitException ex)
{
Console.WriteLine($"Rate limited. Retry after {ex.RetryAfterSeconds}s");
}
catch (LabelInnException ex)
{
Console.WriteLine($"Error [{ex.Status}] {ex.Code}: {ex.Message}");
}
catch (HttpRequestException ex)
{
Console.WriteLine($"Network error: {ex.Message}");
}
Configuration
Control JSON serialization and timeouts:
var client = new LabelInnClient(
apiKey: "sk_live_xxxxx",
baseUrl: "https://custom.api.example.com/v1" // override URL
);
Requirements
- .NET 6.0 or later
- No external NuGet dependencies
Contributing
See GitHub for issues & contributions.
License
MIT — See LICENSE file
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. 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. |
-
net6.0
- No dependencies.
-
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.