Flat records

8. Products

Eight fictional products with prices, categories, and stock status.

Endpoint

GET https://api.mydcts.org/products

Returns an array of eight flat objects as application/json. Public access; no account or API key. No query parameters.

Fields

FieldTypeDescription
idnumberProduct ID.
namestringProduct name.
pricenumberSample price in USD.
categorystringAudio, Computers, Gaming, or School.
inStockbooleanWhether the sample product is in stock.

Sample response

[
  {
    "id": 1,
    "name": "Orbit Headphones",
    "price": 39.99,
    "category": "Audio",
    "inStock": true
  },
  {
    "id": 2,
    "name": "Pixel Keyboard",
    "price": 49.5,
    "category": "Computers",
    "inStock": true
  },
  {
    "id": 3,
    "name": "Nova Controller",
    "price": 34.99,
    "category": "Gaming",
    "inStock": false
  },
  {
    "id": 4,
    "name": "Trail Backpack",
    "price": 29.95,
    "category": "School",
    "inStock": true
  },
  {
    "id": 5,
    "name": "Echo Speaker",
    "price": 24.99,
    "category": "Audio",
    "inStock": false
  },
  {
    "id": 6,
    "name": "Glide Mouse",
    "price": 19.5,
    "category": "Computers",
    "inStock": true
  },
  {
    "id": 7,
    "name": "Quest Mouse Pad",
    "price": 12.0,
    "category": "Gaming",
    "inStock": true
  },
  {
    "id": 8,
    "name": "Canvas Pencil Case",
    "price": 8.75,
    "category": "School",
    "inStock": false
  }
]

Fetch example

fetch("https://api.mydcts.org/products")
  .then(response => {
    if (!response.ok) throw new Error("Request failed: " + response.status);
    return response.json();
  })
  .then(data => console.log(data))
  .catch(error => console.error(error.message));

Request behavior

GET returns data; HEAD returns headers; OPTIONS returns 204. Data stays fixed. Browser requests from VS Code Live Server and other origins are supported.

200 Success · 400 Query parameters are not supported · 405 Write method not allowed