CH

CodeHub

API Playground

← All collections

Collection Docs

Products Collection

Product catalog for validation practice and numeric comparisons.

Fields

text

name

Required; product name.

text

SKU

Required + unique; stock keeping unit identifier.

number

price

Required; must be 0 or greater.

number

inventoryCount

Required; must be 0 or greater.

checkbox

featured

Boolean; defaults to false.

REST Endpoints

GET/api/products

List products. Filter by price range or inventory count.

GET/api/products/:id

Fetch one product by document ID.

POST/api/products

Create a product. Include name, SKU, price, inventoryCount, featured.

PATCH/api/products/:id

Update product fields.

DELETE/api/products/:id

Delete a product document.

Teaching Tips

  • Filter by price: ?where[price][less_than]=100
  • Filter low stock: ?where[inventoryCount][less_than]=10
  • Filter featured: ?where[featured][equals]=true
  • Combine: ?where[price][greater_than]=50&where[inventoryCount][greater_than]=0