.NET Library

The .NET Library exposes Epicor CPQ data to applications built on the Microsoft .net platform

Installing the Epicor CPQ API .NET Library

If you're using .NET, you can now download the Epicor CPQ REST API client library from NuGet which makes it easy to access the Epicor CPQ REST API.

  • From Visual Studio, right-click on a project, and select 'Manage NuGet Packages...'

  • Browse kbmax.http.client, select your project, and install the library:

This will download and install the latest version of the Epicor CPQ REST API client library which supports all the basic operations on Epicor CPQ entities:

  • Get an entity by its id
  • Get all entities using paging
  • Search for entities
  • Insert a new entity
  • Update an existing entity
  • Delete an entity by its id

Supported Entity Types

Currently the following entity types are supported, among others.  Install the current library for specifics.

  • AdminProducts
  • BuildTypes
  • Categories
  • Contacts
  • CustomActions
  • Customers
  • EmailTemplates
  • Generators
  • Logs
  • Builders
  • QuoteOutputs
  • Quotes
  • SafeFunctions
  • Scenes
  • Tables
  • Tags
  • TestBuilds
  • Users
  • Workflows

General Calls

Each of the entities listed above supports the following calls:

Entity-Specific Calls

AdminProducts

Customers

Customers

  • Get - takes an Id, returns a specific item based on given Id value.
  • Search - takes SearchArgs, queries the database with powerful filtering arguments.
  • GetPaged - takes a PagingRequest, returns a list of items with optional paging parameters to limit the number of entities returned.
  • GetBatch - takes a BatchRequest, returns a list of items given a list of Ids in the request.
  • Insert - takes an item, and creates an entry for it in the database. Can only be called in the DEV environment.
  • Update - takes the Id of the item to update, and the actual item itself. Can only be called in the DEV environment.
  • Delete - takes an Id, deletes a specific item. Can only be called in the DEV environment.

In addition to the calls listed above, some entities support additional calls:

  • GetOutput - takes the ID of the Product and the ID of the Output, and returns the specific Output from a product configurator definition.
  • GetCustomerTypes - returns the various customer types we support (Prospect, Direct, Channel, Reseller, Other).
  • GetCustomerByNumber - get a customer by passing in the customerNumber

Logs

EmailTemplates

  • GetPlaceholders - gets a list of available placeholders based on the passed-in template type
  • Logs

  • GetDefaultByType - retrieves the default template that's used for the passed in type.
  • PostBatch - insert many logs at once in the database.

Builders

  • GetByName - get the Output Builder entry by the Output Builder machine name.

QuoteOutputs

  • SaveOutputFields - save the Output Fields of an Output.

SafeFunctions

  • Run - run a safe function by its ID or name. It is suggested you run a safe function by its ID if possible, as the name is more apt to change.
  • Test - test a safe function by its ID.

Scenes

  • Run - run a scene given its ID value
  • Import - import a scene

TestBuilds

  • EditStatus - changes the status of a Test Build.

C# Example

To work on the Quote entity, first setup the credentials to use, and then create an instance of the QuotesClient as shown below:

var credentials = new KbCredentials
{
    CompanySubdomain = "<your company subdomain; see note below>",
    UserName    = "<your username>",
    Password    = "<your password>",
    Environment = eEnvironment.dev,
};

var quotesClient = KbClient.Create<QuotesClient>(credentials);
var quote = await quotesClient.Get(id: 1);



Important

Your CompanySubdomain is the subdomain that appears before kbmax.com, without the environment. So, if you are trying to connect to yourcompany-dev.kbmax.com then the subdomain should be "yourcompany."

For convenience, here's a complete Console Application that prints the Product Id, Name, and Price, and Quote Id, Name, and Total Price for all the Products and Quotes of a company:

Console example

using KBMax;
using KBMax.Models;
using System;
using System.Text;
using System.Threading.Tasks;

class Program
{
    staticvoidMain(string[] args)
    {
        Task.Run(async()=>        {
            var credentials =new KbCredentials
            {
                CompanySubdomain ="<your company name>",
                UserName ="<your username>",
                Password ="<your password>",
                Environment = eEnvironment.dev,
            };
            var productsClient = KbClient.Create<AdminProductsClient>(credentials);
            var quotesClient = KbClient.Create<QuotesClient>(credentials);

            var products = await productsClient.GetPaged(newPagingRequest());
            var quotes = await quotesClient.GetPaged(newPagingRequest());

            var result =newStringBuilder();
            result.AppendLine("Products:");
            foreach(var item in products.Items)
                result.AppendLine(
                    $"{item.Id} - {item.Name} - {item.Price}");
            result.AppendLine("\nQuotes:");
            foreach(var item in quotes.Items)
                result.AppendLine(
                    $"{item.Id} - {item.Name} - {item.TotalPrice}");

            Console.WriteLine(result.ToString());

        }).Wait();
        Console.ReadKey();
    }
}


Was this article helpful?