CH

CodeHub

API Playground

← All collections

Collection Docs

Cars Collection

Vehicle inventory with enum fields (color) and number range validation (year, price).

Fields

text

make

Required; manufacturer name (e.g., "Toyota", "Ford").

text

model

Required; vehicle model name.

number

year

Required; must be between 1900 and current year + 1.

select

color

Required enum: red, blue, black, white, silver, gray, green, yellow.

number

price

Required; must be 0 or greater.

REST Endpoints

GET/api/cars

List cars. Filter by color: ?where[color][equals]=red

GET/api/cars/:id

Fetch one car by document ID.

POST/api/cars

Create a car. Include make, model, year, color, price.

PATCH/api/cars/:id

Update car fields. Partial updates supported.

DELETE/api/cars/:id

Delete a car document.

Teaching Tips

  • Filter by color enum: ?where[color][equals]=blue
  • Filter by price range: ?where[price][greater_than]=20000&where[price][less_than]=50000
  • Filter by year: ?where[year][greater_than_equal]=2020