Posty5.ShortLink
2.0.0
dotnet add package Posty5.ShortLink --version 2.0.0
NuGet\Install-Package Posty5.ShortLink -Version 2.0.0
<PackageReference Include="Posty5.ShortLink" Version="2.0.0" />
<PackageVersion Include="Posty5.ShortLink" Version="2.0.0" />
<PackageReference Include="Posty5.ShortLink" />
paket add Posty5.ShortLink --version 2.0.0
#r "nuget: Posty5.ShortLink, 2.0.0"
#:package Posty5.ShortLink@2.0.0
#addin nuget:?package=Posty5.ShortLink&version=2.0.0
#tool nuget:?package=Posty5.ShortLink&version=2.0.0
Posty5.ShortLink
Create and manage branded short links with analytics tracking, custom slugs, and QR code generation using the .NET SDK. This package provides a client for building URL shortening solutions with editable destinations, comprehensive tracking, and monetization options.
π What is Posty5?
Posty5 is a comprehensive suite of free online tools designed to enhance your digital marketing and social media presence. With over 4+ powerful tools and counting, Posty5 provides everything you need to:
- π Shorten URLs - Create memorable, trackable short links
- π± Generate QR Codes - Transform URLs, WiFi credentials, contact cards, and more into scannable codes
- π Host HTML Pages - Deploy static HTML pages with dynamic variables and form submission handling
- π’ Automate Social Media - Schedule and manage social media posts across multiple platforms
- π Track Performance - Monitor and analyze your digital marketing efforts
Posty5 empowers businesses, marketers, and developers to streamline their online workflowsβall from a unified control panel.
Learn more: https://posty5.com
π¦ About This Package
Posty5.ShortLink is a specialized tool package for creating and managing URL shorteners on the Posty5 platform. It enables developers to build link management systems for marketing campaigns, social media, analytics tracking, and more.
Key Capabilities
- π URL Shortening - Transform long URLs into short, memorable links
- π¨ Custom Slugs - Create branded short links with custom aliases
- π Editable URLs - Update destination URLs without changing the short link
- π Analytics Tracking - Monitor clicks, visitor counts, and last visitor dates
- π± Free QR Codes - Automatic QR code generation for each short link
- π·οΈ Tag & Reference Support - Organize links with custom tags and reference IDs
- π― Landing Pages - Create custom landing pages with titles and descriptions
- π° Monetization - Enable partner earnings on short links
- π Advanced Filtering - Search by name, URL, status, tag, or reference ID
- π API Key Filtering - Scope resources by API key for multi-tenant applications
- π CRUD Operations - Complete create, read, update, delete operations
Role in the Posty5 Ecosystem
This package works seamlessly with other Posty5 SDK packages:
- Combine with
Posty5.QRCodefor enhanced QR code customization - Use with
Posty5.HtmlHostingto create short links for hosted pages - Build comprehensive marketing campaigns with full tracking and analytics
π₯ Installation
Install via NuGet Package Manager:
dotnet add package Posty5.ShortLink
Or via Package Manager Console:
Install-Package Posty5.ShortLink
π Quick Start
Here's a minimal example to get you started:
using Posty5.Core.Configuration;
using Posty5.Core.Http;
using Posty5.ShortLink;
using Posty5.ShortLink.Models;
// Initialize the HTTP client with your API key
var options = new Posty5Options
{
ApiKey = "your-api-key" // Get from https://studio.posty5.com/account/settings?tab=APIKeys
};
var httpClient = new Posty5HttpClient(options);
// Create the Short Link client
var shortLinks = new ShortLinkClient(httpClient);
// Create a short link
var shortLink = await shortLinks.CreateAsync(new CreateShortLinkRequest
{
Name = "Campaign Landing Page",
BaseUrl = "https://example.com/long-url-to-campaign-page",
CustomLandingId = "summer-sale", // Optional: Custom slug
TemplateId = "template-123", // Optional: QR code template ID
Tag = "marketing", // Optional: For organization
RefId = "CAMPAIGN-001" // Optional: External reference
});
Console.WriteLine($"Short Link: {shortLink.ShorterLink}");
Console.WriteLine($"QR Code: {shortLink.QrCodeDownloadURL}");
Console.WriteLine($"Landing Page: {shortLink.QrCodeLandingPageURL}");
// List all short links
var allLinks = await shortLinks.ListAsync(
null,
new PaginationParams { PageNumber = 1, PageSize = 20 }
);
Console.WriteLine($"Total links: {allLinks.Pagination.TotalCount}");
foreach (var link in allLinks.Data)
{
Console.WriteLine($"{link.Name}: {link.NumberOfVisitors} clicks");
}
// Update destination URL (short link stays the same!)
await shortLinks.UpdateAsync(shortLink.Id!, new UpdateShortLinkRequest
{
BaseUrl = "https://example.com/updated-campaign-page",
TemplateId = "template-123"
});
Console.WriteLine("β Destination updated - same short link, new target!");
π API Reference & Examples
Creating Short Links
CreateAsync
Create a new short link with optional custom slug, landing page, and tracking parameters.
Parameters:
request(CreateShortLinkRequest): Short link dataBaseUrl(string, required): Destination URL to redirect toName(string?, optional): Human-readable name for the linkCustomLandingId(string?, optional): Custom slug for branded short linksTemplateId(string?, optional): QR code template IDTag(string?, optional): Custom tag for grouping/filteringRefId(string?, optional): External reference ID from your systemIsEnableMonetization(bool?, optional): Enable partner earningsPageInfo(object?, optional): Landing page metadata
Returns: Task<ShortLinkModel> - Created short link details
Example:
// Basic short link
var shortLink = await shortLinks.CreateAsync(new CreateShortLinkRequest
{
BaseUrl = "https://example.com/product/awesome-widget",
Name = "Product Page - Awesome Widget"
});
Console.WriteLine($"Share this: {shortLink.ShorterLink}");
// Branded link
var brandedLink = await shortLinks.CreateAsync(new CreateShortLinkRequest
{
BaseUrl = "https://example.com/summer-sale-2026",
Name = "Summer Sale 2026",
CustomLandingId = "summer-sale", // Creates: posty5.com/summer-sale
Tag = "seasonal-campaigns",
RefId = "SUMMER-2026"
});
Retrieving Short Links
GetAsync
Retrieve complete details of a specific short link by ID.
Parameters:
id(string): The unique short link ID
Returns: Task<ShortLinkModel> - Short link details
Example:
var link = await shortLinks.GetAsync("short-link-id-123");
Console.WriteLine($"Short Link Details:");
Console.WriteLine($" Name: {link.Name}");
Console.WriteLine($" Short URL: {link.ShorterLink}");
Console.WriteLine($" Destination: {link.BaseUrl}");
Console.WriteLine($" Total Clicks: {link.NumberOfVisitors}");
ListAsync
Search and filter short links with advanced pagination and filtering options.
Parameters:
listParams(ListShortLinksParams?, optional): Filter criteriaName(string?): Filter by link nameBaseUrl(string?): Filter by destination URLTag(string?): Filter by tagRefId(string?): Filter by reference IDStatus(string?): Filter by status
pagination(PaginationParams?, optional): Pagination options
Returns: Task<PaginationResponse<ShortLinkModel>>
Example:
var marketingLinks = await shortLinks.ListAsync(new ListShortLinksParams
{
Tag = "marketing"
});
foreach (var link in marketingLinks.Data)
{
Console.WriteLine($"{link.Name} - {link.ShorterLink}");
}
Updating Short Links
UpdateAsync
Update an existing short link's destination URL or metadata. The short URL remains the same!
Parameters:
id(string): Short link ID to updaterequest(UpdateShortLinkRequest): Updated dataBaseUrl(string, required): New destination URLName(string?, optional): Updated link name- ... other optional fields
Returns: Task<ShortLinkModel>
Example:
// Update destination URL (most common use case)
await shortLinks.UpdateAsync("link-id-123", new UpdateShortLinkRequest
{
BaseUrl = "https://example.com/new-destination",
TemplateId = "template-123"
});
Managing Short Links
DeleteAsync
Permanently delete a short link. The short URL will no longer work.
Parameters:
id(string): Short link ID to delete
Returns: Task
Example:
await shortLinks.DeleteAsync("link-id-123");
π Error Handling
Methods throw exceptions from Posty5.Core.Exceptions.
using Posty5.Core.Exceptions;
try
{
await shortLinks.CreateAsync(new CreateShortLinkRequest
{
BaseUrl = "invalid-url"
});
}
catch (Posty5ValidationException ex)
{
Console.WriteLine($"Invalid URL: {ex.Message}");
}
π Resources
- Official Guides: https://guide.posty5.com
- API Reference: https://docs.posty5.com
- Source Code: https://github.com/Posty5/dotnet-sdk
π¦ Packages
This SDK ecosystem contains the following tool packages:
| Package | Description | Version | NuGet |
|---|---|---|---|
| Posty5.Core | Core HTTP client and models | 1.0.0 | π¦ NuGet |
| Posty5.ShortLink | URL shortener client | 1.0.0 | π¦ NuGet |
| Posty5.QRCode | QR code generator client | 1.0.0 | π¦ NuGet |
| Posty5.HtmlHosting | HTML hosting client | 1.0.0 | π¦ NuGet |
| Posty5.HtmlHostingVariables | Variable management | 1.0.0 | π¦ NuGet |
| Posty5.HtmlHostingFormSubmission | Form submission management | 1.0.0 | π¦ NuGet |
| Posty5.SocialPublisherWorkspace | Social workspace management | 1.0.0 | π¦ NuGet |
| Posty5.SocialPublisherTask | Social publishing task client | 1.0.0 | π¦ NuGet |
π License
MIT License - see LICENSE file for details.
Made with β€οΈ by the Posty5 team
| Product | Versions 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. |
-
net8.0
- Posty5.Core (>= 2.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.