Flat records

10. Equipment

Eight fictional equipment records with categories and availability.

Endpoint

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

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

Fields

FieldTypeDescription
idnumberEquipment ID.
namestringEquipment name.
categorystringPhotography, Audio, Computers, or Lighting.
availablebooleanWhether the sample item is available.

Sample response

[
  {
    "id": 1,
    "name": "Nova Camera",
    "category": "Photography",
    "available": true
  },
  {
    "id": 2,
    "name": "Echo Microphone",
    "category": "Audio",
    "available": false
  },
  {
    "id": 3,
    "name": "Steady Tripod",
    "category": "Photography",
    "available": true
  },
  {
    "id": 4,
    "name": "Pixel Laptop",
    "category": "Computers",
    "available": true
  },
  {
    "id": 5,
    "name": "Orbit Headphones",
    "category": "Audio",
    "available": false
  },
  {
    "id": 6,
    "name": "Glow Light Panel",
    "category": "Lighting",
    "available": true
  },
  {
    "id": 7,
    "name": "Sketch Tablet",
    "category": "Computers",
    "available": false
  },
  {
    "id": 8,
    "name": "Pocket Recorder",
    "category": "Audio",
    "available": true
  }
]

Fetch example

fetch("https://api.mydcts.org/equipment")
  .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));

Single record: JSON

GET https://api.mydcts.org/equipment/1

Returns equipment record 1 as one object, not an array. Content type: application/json. Fields are listed above.

Sample response

{
  "id": 1,
  "name": "Nova Camera",
  "category": "Photography",
  "available": true
}

Fetch example

fetch("https://api.mydcts.org/equipment/1")
  .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));

Single record: XML

GET https://api.mydcts.org/equipment/1.xml

Returns the same fields and values as the JSON single-record endpoint. Content type: application/xml. Root element: equipment. Boolean values are written as true or false; XML element content is text. Only record 1 has a single-record endpoint.

Sample response

<?xml version="1.0" encoding="UTF-8"?>
<equipment>
  <id>1</id>
  <name>Nova Camera</name>
  <category>Photography</category>
  <available>true</available>
</equipment>

Fetch example

fetch("https://api.mydcts.org/equipment/1.xml")
  .then(response => {
    if (!response.ok) throw new Error("Request failed: " + response.status);
    return response.text();
  })
  .then(text => {
    const xml = new DOMParser().parseFromString(text, "application/xml");
    console.log(xml.querySelector("name").textContent);
  })
  .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