Auctionmarts SDK Documentation

Overview

Welcome to the Auctionmarts SDK documentation. The Auctionmarts SDK is designed to integrate seamlessly with Auctionmarts services, enabling developers to manage auctions, buyers, lots, categories, and related entities. This documentation includes comprehensive guides, example implementations, and detailed API references.


Getting Started

To use this SDK, follow these steps:

  1. Clone the repository (if applicable):

    
    git clone https://newline-asp.visualstudio.com/Auctionmarts%20SDK/_git/Auctionmarts.Sdk
    cd Auctionmarts.Sdk
    
  2. Install dependencies (if needed, e.g., for .NET):

    dotnet restore
    
  3. Review Example Implementations: The examples/ directory contains standalone Program.cs files demonstrating various services of the SDK. These examples provide practical insights into how the SDK is used.

  4. Configure Authentication: If the API requires authentication, refer to the Authentication section in this documentation or review the configuration files in the repository to set up your credentials.


Sample Projects

This repository includes a set of sample projects demonstrating practical usage of the SDK:

🔹 Token Authentication

A simple console tool to:

  • Authenticate a user via API key
  • Generate a short-lived SSO token
  • Print a clickable login link

🔹 Buyer Management

An interactive tool to:

  • List all buyers
  • Prompt for a new credit limit
  • Apply the new limit in parallel to all buyers

🔹 Example Auction Script

Demonstrates:

  • Creating required data (terms, categories, increment sets)
  • Creating a timed auction
  • Adding lots
  • Generating SSO links for the sale and its lots

🔹 Example Realtime Auction Info

This example project (located in the examples/Auctionmarts.Sdk.RealtimeLotInfo folder) demonstrates how to connect to the Auctionmarts SignalR hub and listen for live auction events.

It includes everything you need to:

  • ✅ Create a test timed auction

  • ✅ Generate lots and SSO links

  • ✅ Connect to the SignalR endpoint

  • ✅ Receive and log events such as:

    • LotAdded
    • LotDeleted
    • LotEnded
    • BidPlaced
    • LotEndTimesUpdated
    • TimeCheck

Each event is printed to the console as indented JSON for easy inspection.

âš¡ Why use Realtime?

You will get real-time feedback as bidding activity occurs, allowing you to:

  • Monitor lot state changes without polling
  • Build dashboards or integrations that respond instantly to auction events
  • Extend the experience with notifications, analytics, or operations dashboards

Each script uses top-level statements and is intended for rapid development and integration testing.


Authentication

To interact with the API, you must authenticate using an API key. Tokens are valid for 30 minutes, while * application tokens* (used for SSO) expire after 30 seconds.

Retrieve an Authentication Token

var tokenService = provider.GetRequiredService<ITokenService>();

var tokenResponse = await tokenService.GetTokenAsync(new TokenRequest
{
    Username = "your_email@example.com",
    Hash = "YourGeneratedApiKey"
}, CancellationToken.None);

if (tokenResponse.Success)
{
    Console.WriteLine($"Token: {tokenResponse.Data!.Token}");
}
else
{
    Console.WriteLine($"Error: {tokenResponse.ErrorMessage}");
}

Retrieve an Application Token for SSO

var ssoTokenResponse = await tokenService.GetApplicationTokenAsync(new ApplicationTokenRequest
{
    Application = "Auctionmarts.Sdk.BuyerUpdates",
    Username = "your_email@example.com",
    Hash = "YourGeneratedApiKey"
}, CancellationToken.None);

if (ssoTokenResponse.Success)
{
    Console.WriteLine($"SSO Link: {ssoTokenResponse.Data!.WebsiteLink}");
}

Buyer Management

Create, approve, and delete buyers using the SDK.

Create a Buyer

var buyerService = provider.GetRequiredService<IBuyerService>();

var createBuyerRequest = new CreateBuyerRequest
{
    Username = "your_email@example.com",
    Password = "SecurePassword123",
    UserDetails = new CreateUserDetailsRequest
    {
        Title = "Mr",
        FirstName = "John",
        Surname = "Smith",
        CompanyName = "TestCo",
        TaxRegistered = false
    }
};

var createBuyerResponse = await buyerService.CreateBuyerAsync(createBuyerRequest);

Approve a Buyer

var approveRequest = new UpdateBuyerApproval
{
    BuyerApproval = new BuyerApproval
    {
        UserId = createBuyerResponse.Data!.Id,
        CreditLimit = 1000,
        Approved = true,
        Message = "You are now approved"
    }
};

var approveBuyerResponse = await buyerService.UpdateBuyerApprovalAsync(approveRequest);

Delete a Buyer

var deleteResponse = await buyerService.DeleteBuyerRegistrationAsync(createBuyerResponse.Data!.Id);

Group Management

Retrieve All Groups

var groupService = provider.GetRequiredService<IGroupService>();

var groupsResponse = await groupService.GetGroupsAsync();

foreach (var group in groupsResponse.Data!)
{
    Console.WriteLine($"Group: {group.Name}");
}

Add a User to a Group

var addUserRequest = new CreateGroupMemberRequest
{
    GroupId = someGroupId,
    UserId = createBuyerResponse.Data!.Id
};

await groupService.CreateGroupMemberAsync(addUserRequest.GroupId, addUserRequest.UserId);

Terms Management

Retrieve All Terms

var termsService = provider.GetRequiredService<ITermsService>();

var termsResponse = await termsService.GetTermsAsync();

foreach (var term in termsResponse.Data!)
{
    Console.WriteLine($"Term: {term.Description}");
}

Create a Term

var createTermRequest = new CreateTermRequest
{
    HTML = "<p>By using this service, you agree to the terms.</p>",
    Description = "General Terms",
    TermType = 0
};

var createTermResponse = await termsService.CreateTermAsync(createTermRequest);

Sale Categories

Retrieve Portal Categories

var categoryService = provider.GetRequiredService<ISaleCategoryService>();

var portalCategoriesResponse = await categoryService.GetPortalCategoriesAsync();

foreach (var category in portalCategoriesResponse.Data!)
{
    Console.WriteLine($"Category: {category.Value}");
}

Create a Sale Category

var createCategoryRequest = new CreateSaleCategoryRequest
{
    Value = "New Category",
    PortalItem = true,
    Image = "image-url",
    Visible = true,
    HideHeader = false,
    Order = 1
};

var createCategoryResponse = await categoryService.CreateSaleCategoryAsync(createCategoryRequest);

Increment Sets

Create an Increment Set

var incrementSetService = provider.GetRequiredService<IIncrementSetService>();

var createIncrementSetRequest = new CreateIncrementSetRequest
{
    Name = "Test Set",
    Description = "Increment test",
    Increments = new List<CreateIncrement>
    {
        new() { From = 100, Value = 10 },
        new() { From = 200, Value = 20 },
        new() { From = 300, Value = 30 }
    }
};

var createIncrementSetResponse = await incrementSetService.CreateIncrementSetAsync(createIncrementSetRequest);

Installation

  1. Add the SDK package to your project:

    dotnet add package Auctionmarts.Sdk
    
  2. Register the SDK services in your application:

var services = new ServiceCollection();

services.AddAuctionmartsSdk(new AuthenticationOptions
{
    Uri = "https://api.auctionmarts.com",
    Username = "your_username",
    ApiKey = "your_api_key",
    CompanyId = Guid.NewGuid(),
    SiteId = Guid.NewGuid(),
    Website = "https://auctionmarts.com"
});

var provider = services.BuildServiceProvider();

Support

For support, contact Newline Software Support.


Version 2025.11.7

© 2025 Newline ASP. All rights reserved.