{
  "id": 10829926,
  "title": "Build a Product Catalog in YunCMS: From Studio to REST API",
  "url": "https://urgent.news/2026/09/30/build-a-product-catalog-in-yuncms-from-studio-to-rest-api",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-09-30T02:02:54.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/yunsoft/build-a-product-catalog-in-yuncms-from-studio-to-rest-api-1mch"
  },
  "original_language": "en",
  "account": "Creating a product catalog in YunCMS involves several steps. First, establish an interface for managing product records. This interface resides within YunCMS, which also provides an API for the application to read those records. A boundary is set to keep unfinished or draft products out of the public response.\n\nIn this walkthrough, three products are managed in the YunCMS Studio. An anonymous request to the catalog will only return the two active products, with the fields chosen by the requester. The system handles SKU and stock on the management side, and anonymous users cannot create or delete records.\n\nBefore starting, ensure YunCMS is running and accessible in the browser at http://localhost:3038. Use the username/password provided by the installation process to sign in to Studio as an Administrator. The example uses demonstration data, so test the exact release and permissions you use. The YunCMS installation is verified as of September 30, 2026.\n\nTo begin, create a product collection by navigating to Data Model in Studio and choosing Create collection. Enter \"Products\" as the display name and \"products\" as the API/database key. A description is optional but recommended. The display name is visible to users, while the API key is used in URLs and integrations. Keep recommended fields for creation and update timestamps, as well as user-accountability fields. YunCMS maintains these system fields automatically when records are changed. Note that renaming the display label does not alter the API key.\n\nNext, define the catalog fields by opening the collection, selecting Fields → Add field, and adding five fields. Set the human label, API key, and appropriate field type separately. The display name should be \"Product name,\" the API key \"name,\" and the field type \"Short text.\" Mark the field as \"Required.\" Repeat this process for \"SKU\" (API key \"sku\"), \"Price\" (API key \"price,\" type \"Decimal,\" precision 12, scale 2), \"Stock\" (API key \"stock,\" type \"Integer\"), and \"Status\" (API key \"status,\" type \"Short text\"). The default status should be \"draft.\" Remember that a short-text field does not inherently enforce an enumeration, and you may need to implement custom validation rules for more complex workflows. The price is stored as a Decimal type, using the MySQL precision and scale you selected.\n\nAdd two active products and one draft record using Content → Products → New record. The draft product serves as a concrete example to check the public permission filter later. The record details are: Canvas Backpack with SKU BAG-001, price 1490.00, stock 18, and status active; Ceramic Mug with SKU MUG-001, price 320.00, stock 42, and status active; Desk Lamp with SKU LAMP-001, price 890.00, stock 7, and status draft. The Administrator can view all three records, including their SKU and stock. Sorting by Product name results in the list being sorted alphabetically. Editing a product in Studio does not create a separate API copy; both Studio and the Items API work with the same collection data.\n\nFinally, limit public access to reading the catalog. Navigate to Access → Public and enable the public read action for the Products collection. Turn off Allow all fields and select only id, name, price, and status. A custom row rule is added to filter results: Status must equal \"active.\" The JSON equivalent of this rule is `{ \"status\": { \"_eq\": \"active\" } }`. Public Create, Update, and Delete permissions are left off, ensuring these actions are restricted. The backend permission rule defines both readable fields and readable records, ensuring that even if a collection is shown in Content navigation, it does not automatically grant public access. The same catalog can be accessed through REST by sending a GET request to `/items/products`, using the query parameters `fields=name,price,status`, `sort=name`, and `limit=20`. The request can be made anonymously without an Authorization header. Initially, this request would return a 403 error. After saving the public read permission rule, the response returns a 200 status, providing a JSON object containing the two active products. The Desk Lamp product, which has a draft status, is omitted from the response. The price fields are returned as JSON strings, requiring explicit formatting in the frontend.",
  "summary": "A product catalog needs an interface where a team can manage records, an API that the application can read, and a boundary that keeps unfinished products out of the public response. This walkthrough brings those three needs together in YunCMS. We will manage three products in Studio. An anonymous catalog request will return only the two active products and only the fields we choose. SKU and stock…",
  "key_points": [
    "YunCMS establishes product record interface within platform",
    "Three products managed in YunCMS Studio with active/draft status",
    "Public REST API returns active products filtered by status"
  ],
  "editors_take": "Setting up a product catalog in YunCMS this way enables administrators to manage products while restricting public access to only active products with selectively exposed fields.",
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}