Posty5.ShortLink 2.0.0

dotnet add package Posty5.ShortLink --version 2.0.0
                    
NuGet\Install-Package Posty5.ShortLink -Version 2.0.0
                    
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="Posty5.ShortLink" Version="2.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Posty5.ShortLink" Version="2.0.0" />
                    
Directory.Packages.props
<PackageReference Include="Posty5.ShortLink" />
                    
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 Posty5.ShortLink --version 2.0.0
                    
#r "nuget: Posty5.ShortLink, 2.0.0"
                    
#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.
#:package Posty5.ShortLink@2.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Posty5.ShortLink&version=2.0.0
                    
Install as a Cake Addin
#tool nuget:?package=Posty5.ShortLink&version=2.0.0
                    
Install as a Cake Tool

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.QRCode for enhanced QR code customization
  • Use with Posty5.HtmlHosting to 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

CreateAsync

Create a new short link with optional custom slug, landing page, and tracking parameters.

Parameters:

  • request (CreateShortLinkRequest): Short link data
    • BaseUrl (string, required): Destination URL to redirect to
    • Name (string?, optional): Human-readable name for the link
    • CustomLandingId (string?, optional): Custom slug for branded short links
    • TemplateId (string?, optional): QR code template ID
    • Tag (string?, optional): Custom tag for grouping/filtering
    • RefId (string?, optional): External reference ID from your system
    • IsEnableMonetization (bool?, optional): Enable partner earnings
    • PageInfo (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"
});

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 criteria
    • Name (string?): Filter by link name
    • BaseUrl (string?): Filter by destination URL
    • Tag (string?): Filter by tag
    • RefId (string?): Filter by reference ID
    • Status (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}");
}

UpdateAsync

Update an existing short link's destination URL or metadata. The short URL remains the same!

Parameters:

  • id (string): Short link ID to update
  • request (UpdateShortLinkRequest): Updated data
    • BaseUrl (string, required): New destination URL
    • Name (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"
});

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


πŸ“¦ 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 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.

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
2.0.0 94 2/1/2026
1.0.0 95 1/21/2026