Use Case: Manage Sales Items

Prev Next

For: Customers · Partners · Integrators

Sales items are maintained in a system of record, such as an ERP or PIM system, and need to be available in orderManager for configuration and quote creation.

Challenge

If the item catalog is also maintained manually in orderManager in addition to the system of record, names, descriptions, images, and translations drift out of sync, and sales may offer items that are no longer available.

Solution

The system of record creates, updates, and deletes sales items through the Sales API. Each item belongs to a library and catalog and is identified by its articleId. Names, descriptions, and categories can be provided in multiple languages.

Method Purpose
GET /api/orderManager/sales/articles?take=&skip= Read items page by page. The response contains data, take, and skip.
GET /api/orderManager/sales/articles/{articleId} Read an individual item.
POST /api/orderManager/sales/articles Create an item.
PUT /api/orderManager/sales/articles Update an existing item. The articleId in the body identifies the item.
DELETE /api/orderManager/sales/articles?articleId= Delete one or more items.
GET /api/orderManager/sales/masterData?libraryId= Read the modules and attributes available in a library for describing items.

Item Properties

Property Meaning
libraryId, catalog The library and catalog to which the item belongs.
articleId Unique ID of the item within its catalog.
articleName, articleNameLocalized English name and translations keyed by language code.
description, descriptionLocalized English description and translations.
category, categoryLocalized English category and translations.
imageUrl Optional URL of a preview image.
isConfigDummy Identifies a configuration dummy (sub-item) rather than a real item.
roots One or more root modules for the item, including position and rotation.

Workflow

  1. Read the library's master data to find out which modules and attributes are available.
  2. Create each new item from the system of record using POST.
  3. Read each changed item, apply the changes, and send the complete item using PUT.
  4. Delete items that have been removed from the system of record.
// SalesClient expects an HttpClient configured with the base address
// https://connect.homag.cloud and Basic Authentication.
ISalesClient sales = new SalesClient(httpClient);

var masterData = await sales.GetMasterData("Default");

var article = await sales.CreatePosArticle(new PosArticle
{
    LibraryId = "Default",
    Catalog = "Kitchen",
    ArticleId = "BC-600",
    ArticleName = "Base cabinet 600",
    ArticleNameLocalized = { ["de"] = "Unterschrank 600" },
    Category = "Base cabinets",
    ImageUrl = "https://example.com/images/bc-600.png"
});

article.Description = "Base cabinet with one door";
await sales.UpdatePosArticle(article);

await sales.DeletePosArticles(["BC-450", "BC-500"]);
GET /api/orderManager/sales/masterData?libraryId=Default

POST /api/orderManager/sales/articles
Content-Type: application/json

{
  "libraryId": "Default",
  "catalog": "Kitchen",
  "articleId": "BC-600",
  "articleName": "Base cabinet 600",
  "articleNameLocalized": { "de": "Unterschrank 600" },
  "category": "Base cabinets",
  "imageUrl": "https://example.com/images/bc-600.png"
}

200 OK

PUT /api/orderManager/sales/articles
Content-Type: application/json

{ "articleId": "BC-600", "description": "Base cabinet with one door", ... }

200 OK

DELETE /api/orderManager/sales/articles?articleId=BC-450&articleId=BC-500

204 No Content

Option: Read All Items

To synchronize the catalog with the system of record, read all items page by page until a page contains fewer items than take.

const int take = 100;
var skip = 0;
PosArticlesResponse page;

do
{
    page = await sales.GetPosArticles(take, skip);
    // Compare page.Data with the system of record
    skip += take;
}
while (page.Data.Count == take);
GET /api/orderManager/sales/articles?take=100&skip=0

200 OK
{
  "data": [ { "articleId": "BC-600", "articleName": "Base cabinet 600", ... } ],
  "take": 100,
  "skip": 0
}

Integration Architecture

Run item synchronization as a scheduled job or trigger it when the system of record changes. Use the articleId from the system of record so both systems refer to the same item. Since PUT replaces the item, always send the complete item, not just the changed properties.

Sales and Point of Sale

The Sales routes maintain the item catalog. The Point-of-Sale routes under /api/pos/libraries/{libraryId} read a library's items, master data, and calculation script for display and price calculation in a sales application. See Use Case: Calculate Prices.

Benefits

  • One item catalog, maintained in the system of record.
  • Names, descriptions, and categories in multiple languages.
  • Sales only offers items that are available.

API reference: See Endpoints → HOMAG Connect orderManager → Sales: Get items (GET /api/orderManager/sales/articles), Get individual items (GET /api/orderManager/sales/articles/{articleId}), Delete items (DELETE /api/orderManager/sales/articles), and Get master data (GET /api/orderManager/sales/masterData).